diff options
author | Steve McIntyre <steve.mcintyre@linaro.org> | 2014-12-24 02:18:08 +0000 |
---|---|---|
committer | Steve McIntyre <steve.mcintyre@linaro.org> | 2014-12-24 02:18:08 +0000 |
commit | 6f17b100d3c37919a5b788c2a19a69c0ee4b924d (patch) | |
tree | ec2cca5f1c53923e5cf22687cd1bbdde04c3a139 /util.py | |
parent | 0f893601e5da52b06948a4562a8fde70897e6feb (diff) |
Make sure we use vlan_ids, not tags, when adding new ports
Change-Id: If9c24c84fd8034fc7211717edeed4c4f2d9a9144
Diffstat (limited to 'util.py')
-rw-r--r-- | util.py | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -709,7 +709,9 @@ class VlanUtil: # VLAN on the switch. We'll end up changing this after # import if needed. port_vlan = s.port_get_access_vlan(port_name) - port_id = db.create_port(switch_id, port_name, port_vlan, port_vlan) + port_vlan_id = db.get_vlan_id_by_tag(port_vlan) + port_id = db.create_port(switch_id, port_name, + port_vlan_id, port_vlan_id) print ' access port, VLAN %d' % int(port_vlan) # Nothing further needed elif port_mode == 'trunk': @@ -721,10 +723,11 @@ class VlanUtil: port_vlans = s.port_get_trunk_vlan_list(port_name) print ' trunk port has VLANs:' print port_vlans - if port_vlans is None or 'ALL' in port_vlans: - port_vlans = (state.default_vlan_id,) # easy for our purposes + if port_vlans == [] or port_vlans is None or 'ALL' in port_vlans: + port_vlans = (state.config.vland.default_vlan_tag,) # easy for our purposes + port_vlan_id = db.get_vlan_id_by_tag(port_vlans[0]) port_id = db.create_port(switch_id, port_name, - port_vlans[0], port_vlans[0]) + port_vlan_id, port_vlan_id) # Append to a list of trunk ports that we will need to # modify once we're done trunk_ports.append(port_id) |