aboutsummaryrefslogtreecommitdiff
path: root/util.py
diff options
context:
space:
mode:
authorSteve McIntyre <steve.mcintyre@linaro.org>2015-08-05 13:52:48 +0100
committerSteve McIntyre <steve.mcintyre@linaro.org>2015-08-05 13:52:48 +0100
commitea75397199fd3da5b51d8c70d68051b4de5ee1bf (patch)
treea24480015703129b913cb7dbfa570fef25ceb03f /util.py
parentd5cfde1166a6966d454315e6bc94f891faa9e0f4 (diff)
Add the new number field in the ports table
Added in several places: * database creation code * port addition code Change-Id: Id4e2bd2704d5b9660df8baad34abda0f613ba4f2
Diffstat (limited to 'util.py')
-rw-r--r--util.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/util.py b/util.py
index d1b2a51..45f82a3 100644
--- a/util.py
+++ b/util.py
@@ -130,6 +130,7 @@ class VlanUtil:
ret = db.create_switch(data['name'])
elif command == 'db.create_port':
ret = db.create_port(data['switch_id'], data['name'],
+ int(data['number']),
state.default_vlan_id,
state.default_vlan_id)
elif command == 'db.delete_switch':
@@ -722,6 +723,7 @@ class VlanUtil:
logging.debug(' trying to import port %s', port_name)
port_id = None
port_mode = s.port_get_mode(port_name)
+ port_number = s.port_map_name_to_number(port_name)
if port_mode == 'access':
# Access ports are easy - just create the port, and
# set both the current and base VLANs to the current
@@ -729,7 +731,7 @@ class VlanUtil:
# import if needed.
port_vlans[port_name] = (s.port_get_access_vlan(port_name),)
port_vlan_id = db.get_vlan_id_by_tag(port_vlans[port_name][0])
- port_id = db.create_port(switch_id, port_name,
+ port_id = db.create_port(switch_id, port_name, port_number,
port_vlan_id, port_vlan_id)
logging.debug(' access port, VLAN %d', int(port_vlans[port_name][0]))
# Nothing further needed
@@ -744,7 +746,7 @@ class VlanUtil:
if port_vlans[port_name] == [] or port_vlans[port_name] is None or 'ALL' in port_vlans[port_name]:
port_vlans[port_name] = (state.config.vland.default_vlan_tag,)
port_vlan_id = db.get_vlan_id_by_tag(port_vlans[port_name][0])
- port_id = db.create_port(switch_id, port_name,
+ port_id = db.create_port(switch_id, port_name, port_number,
port_vlan_id, port_vlan_id)
# Append to a list of trunk ports that we will need to
# modify once we're done
@@ -757,7 +759,7 @@ class VlanUtil:
s.port_set_mode(port_name, 'access')
port_vlans[port_name] = (s.port_get_access_vlan(port_name),)
port_vlan_id = db.get_vlan_id_by_tag(port_vlans[port_name][0])
- port_id = db.create_port(switch_id, port_name,
+ port_id = db.create_port(switch_id, port_name, port_number,
port_vlan_id, port_vlan_id)
logging.debug(' Found port in %s mode', port_mode)
logging.debug(' Forcing to access mode, VLAN %d', int(port_vlans[port_name][0]))