Juniper / puppet-netdev-stdlib-junos

Junos specific Provider code for "netdev_stdlib". Netdev is a vendor-neutral network abstraction framework developed by Juniper Networks and contributed freely to the DevOps community.
Apache License 2.0
25 stars 14 forks source link

Trunk to access and access to access conversion fails #4

Closed ganeshrn closed 9 years ago

ganeshrn commented 10 years ago

Puppet manifest info: netdev_l2_interface { "ge-0/0/1": untagged_vlan => [ Pink ], ensure => present, }

% puppet agent --test Info: Retrieving pluginfacts Info: Retrieving plugin ldapname is deprecated and will be removed in a future version

Info: Applying configuration version '1407236644' Notice: /Stage[main]/Main/Node[]/Netdev_vlan[Blue]/ensure: created Notice: /Stage[main]/Main/Node[]/Netdev_vlan[Red]/ensure: created Notice: /Stage[main]/Main/Node[]/Netdev_vlan[Green]/ensure: created Notice: /Stage[main]/Main/Node[]etdev_vlan[Pink]/ensure: created Notice: /Stage[main]/Main/Node[]/Netdev_l2_interface[ge-0/0/1]/ensure: created Info: JUNOS: Committing 5 changes. Notice: JUNOS:

[edit]

Notice: JUNOS: OK: COMMIT success! Notice: Finished catalog run in 11.99 seconds

puppet> show configuration |display set | match ge-0/0/1 set interfaces ge-0/0/1 unit 0 description "Puppet created netdev_l2_interface: ge-0/0/1" set interfaces ge-0/0/1 unit 0 family ethernet-switching interface-mode access set interfaces ge-0/0/1 unit 0 family ethernet-switching vlan members 105 >>>>>>>>>>>>>>>>>>> port as acess and part of pink vlan

{master:0}

Manifest file is changed to make the access port part of new vlan:

netdev_l2_interface { "ge-0/0/1": untagged_vlan => [ Green ], >>>>>>>>>>>>>>>>> changed to green vlan ensure => present, }

% puppet agent --test Info: Retrieving pluginfacts Info: Retrieving plugin ldapname is deprecated and will be removed in a future version

Info: Applying configuration version '1407236750' Notice: /Stage[main]/Main/Node[]/Netdev_l2_interface[ge-0/0/1]/tagged_vlans: tagged_vlans changed '[]' to '[Green]' Notice: /Stage[main]/Main/Node[]/Netdev_l2_interface[ge-0/0/1]/untagged_vlan: untagged_vlan changed 'Pink' to 'Green' Info: JUNOS: Committing 1 changes. Notice: JUNOS:

[edit interfaces ge-0/0/1 unit 0 family ethernet-switching vlan]

Notice: JUNOS: OK: COMMIT success! Notice: Finished catalog run in 7.98 seconds

puppet> show configuration |display set |match ge-0/0/1 set interfaces ge-0/0/1 unit 0 description "Puppet created netdev_l2_interface: ge-0/0/1" set interfaces ge-0/0/1 unit 0 family ethernet-switching interface-mode access set interfaces ge-0/0/1 unit 0 family ethernet-switching vlan members 105 >>>>>>>>>>>>> vlan id is retained and not changed to new vlan.

{master:0} puppet>

Below is a different scenario from above:

Trunk port to access port conversion is not happening:

Manifest info on puppet master:

netdev_l2_interface { "ge-0/0/1": tagged_vlans => [ Green,Pink ], ensure => present, }

Pulling config from puppet master:

% puppet agent --test Info: Retrieving pluginfacts Info: Retrieving plugin ldapname is deprecated and will be removed in a future version Info: Caching catalog for Info: Applying configuration version '1407236914' Notice: /Stage[main]/Main/Node[]/Netdev_vlan[Blue]/ensure: created Notice: /Stage[main]/Main/Node[]/Netdev_vlan[Red]/ensure: created Notice: /Stage[main]/Main/Node[]/Netdev_vlan[Green]/ensure: created Notice: /Stage[main]/Main/Node[]/Netdev_vlan[Pink]/ensure: created Notice: /Stage[main]/Main/Node[]/Netdev_l2_interface[ge-0/0/1]/ensure: created Info: JUNOS: Committing 5 changes. Notice: JUNOS:

[edit]

Notice: JUNOS: OK: COMMIT success! Notice: Finished catalog run in 13.06 seconds % cli s{master:0} puppet> show configuration |display set |match ge-0/0/1 set interfaces ge-0/0/1 unit 0 description "Puppet created netdev_l2_interface: ge-0/0/1" set interfaces ge-0/0/1 unit 0 family ethernet-switching interface-mode trunk >>>>>>>>>>>> configured as trunk with vlans 105,108 set interfaces ge-0/0/1 unit 0 family ethernet-switching vlan members 105 set interfaces ge-0/0/1 unit 0 family ethernet-switching vlan members 108

{master:0} puppet>

Changing the manifest file to convert trunk port to access port and pulling the config:

netdev_l2_interface { "ge-0/0/1": untagged_vlan => [ Red ], ensure => present, }

puppet> show vlans

Routing instance VLAN name Tag Interfaces default-switch Blue 107

default-switch Green 108
ge-0/0/1.0 default-switch Pink 105
ge-0/0/1.0
default-switch Red 106 >>>>>>>>>>>>>>>>>>>>>>>> RED VLAN is configured on DUT.

default-switch default 1

{master:0} puppet>

% puppet agent --test Info: Retrieving pluginfacts Info: Retrieving plugin ldapname is deprecated and will be removed in a future version Info: Caching catalog for Info: Applying configuration version '1407237107' Notice: /Stage[main]/Main/Node[]/Netdev_l2_interface[ge-0/0/1]/vlan_tagging: vlan_tagging changed 'enable' to 'disable' Notice: /Stage[main]/Main/Node[]/Netdev_l2_interface[ge-0/0/1]/tagged_vlans: tagged_vlans changed '[Pink,Green]' to '[Red]' Notice: /Stage[main]/Main/Node[]/Netdev_l2_interface[ge-0/0/1]/untagged_vlan: untagged_vlan changed '' to 'Red' Info: JUNOS: Committing 1 changes. Notice: JUNOS:

[edit interfaces ge-0/0/1 unit 0 family ethernet-switching]

Notice: JUNOS: OK: COMMIT success! Notice: Finished catalog run in 7.72 seconds % cli {master:0} puppet> show configuration |display set |match ge-0/0/1 set interfaces ge-0/0/1 unit 0 description "Puppet created netdev_l2_interface: ge-0/0/1" set interfaces ge-0/0/1 unit 0 family ethernet-switching interface-mode trunk >>>>>>>>>>>>>>>> port mode is not changed to access set interfaces ge-0/0/1 unit 0 family ethernet-switching vlan members 105 set interfaces ge-0/0/1 unit 0 family ethernet-switching vlan members 108

{master:0} puppet>

ganeshrn commented 9 years ago

Fix committed fd9acd46197dc0759e706e9184780182078a53b5