Limit fields added to BasicDeviceConfig
- Fixing opticalUtils.py, which was broken due to additional constraint added by
Change-Id: I372e6c7e6c0fa6fa52301568af73342aaae6347b
Change-Id: I4233550c9e483448599a2dd501a50309ceb2e4c8
diff --git a/tools/test/topos/opticalUtils.py b/tools/test/topos/opticalUtils.py
index 19b898b..8d20fad 100644
--- a/tools/test/topos/opticalUtils.py
+++ b/tools/test/topos/opticalUtils.py
@@ -504,6 +504,10 @@
links = {}
devices = {}
ports = {}
+ BasicDevConfigKeys = ['name', 'type', 'latitude', 'longitude', 'allowed',
+ 'rackAddress', 'owner', 'driver', 'manufacturer',
+ 'hwVersion', 'swVersion', 'serial',
+ 'managementAddress']
for switch in LINCSwitch.opticalJSON[ 'devices' ]:
# Build device entries - keyed on uri (DPID) and config key 'basic'
@@ -511,7 +515,7 @@
# Annotations hold switch name and latitude/longitude
devDict = {}
devDict[ 'type' ] = switch[ 'type' ]
- devDict.update(switch[ 'annotations' ])
+ devDict.update({k: v for k, v in switch[ 'annotations' ].iteritems() if k in BasicDevConfigKeys})
devSubj = switch[ 'uri' ]
devices[ devSubj ] = { 'basic': devDict }