diff --git a/confluent_server/confluent/config/attributes.py b/confluent_server/confluent/config/attributes.py index a83520f0..1a14d887 100644 --- a/confluent_server/confluent/config/attributes.py +++ b/confluent_server/confluent/config/attributes.py @@ -93,9 +93,10 @@ node = { 'description': ('List of static groups for which this node is ' 'considered a member'), }, - #'type': { - # 'description': ('Classification of node as system, vm, etc') - #}, + 'type': { + 'description': ('Classification of node as server or switch'), + 'validvalues': ('switch', 'server'), + }, #'id': { # 'description': ('Numeric identifier for node') #}, diff --git a/confluent_server/confluent/networking/macmap.py b/confluent_server/confluent/networking/macmap.py index 2522a030..0a374d5a 100644 --- a/confluent_server/confluent/networking/macmap.py +++ b/confluent_server/confluent/networking/macmap.py @@ -315,10 +315,12 @@ def _full_updatemacmap(configmanager): 'Network topology not available to tenants') # here's a list of switches... need to add nodes that are switches nodelocations = configmanager.get_node_attributes( - configmanager.list_nodes(), ('net*.switch', 'net*.switchport')) + configmanager.list_nodes(), ('type', 'net*.switch', 'net*.switchport')) switches = set([]) for node in nodelocations: cfg = nodelocations[node] + if cfg.get('type', {}).get('value', None) == 'switch': + switches.add(node) for attr in cfg: if not attr.endswith('.switch') or 'value' not in cfg[attr]: continue diff --git a/confluent_server/confluent/networking/netutil.py b/confluent_server/confluent/networking/netutil.py index 60106c34..508c8662 100644 --- a/confluent_server/confluent/networking/netutil.py +++ b/confluent_server/confluent/networking/netutil.py @@ -42,10 +42,12 @@ def get_switchcreds(configmanager, switches): def list_switches(configmanager): nodelocations = configmanager.get_node_attributes( - configmanager.list_nodes(), ('net*.switch', 'net*.switchport')) + configmanager.list_nodes(), ('type', 'net*.switch', 'net*.switchport')) switches = set([]) for node in nodelocations: cfg = nodelocations[node] + if cfg.get('type', {}).get('value', None) == 'switch': + switches.add(node) for attr in cfg: if not attr.endswith('.switch') or 'value' not in cfg[attr]: continue