|
32 | 32 | ) |
33 | 33 |
|
34 | 34 | class CEOS_NODE(): |
35 | | - def __init__(self, node_name, node_ip, node_mgmt_mac, node_neighbors, _tag, image): |
| 35 | + def __init__(self, node_name, node_ip, mgmt_mac, node_mac, node_neighbors, _tag, image): |
36 | 36 | self.name = node_name |
37 | 37 | self.ip = node_ip |
38 | 38 | self.tag = _tag.lower() |
39 | 39 | self.image = image |
40 | 40 | self.ceos_name = self.tag + self.name |
41 | 41 | self.intfs = {} |
42 | | - self.mgmt_mac = node_mgmt_mac |
43 | | - self.system_mac = generateMac() |
44 | 42 | self.dev_id = CEOS_MAPPER[self.name] |
45 | 43 | self.portMappings(node_neighbors) |
| 44 | + if mgmt_mac: |
| 45 | + self.mgmt_mac = node_mac |
| 46 | + self.system_mac = generateMac() |
| 47 | + else: |
| 48 | + self.mgmt_mac = generateMac() |
| 49 | + self.system_mac = node_mac |
| 50 | + |
| 51 | + |
46 | 52 |
|
47 | 53 | def portMappings(self, node_neighbors): |
48 | 54 | """ |
@@ -343,7 +349,16 @@ def main(args): |
343 | 349 | except: |
344 | 350 | pS("INFO", "New CV schema not formatted correctly") |
345 | 351 | cv_nodes = False |
346 | | - |
| 352 | + # Perform check to see if the defined MAC should be used for the System ID or Ma0 Interface |
| 353 | + try: |
| 354 | + mgmt_mac = topo_yaml['infra']['mac_mgmt'] |
| 355 | + if mgmt_mac: |
| 356 | + pS("INFO", "Device MAC Address will be used for the Ma0 interface") |
| 357 | + else: |
| 358 | + pS("INFO", "Device MAC Address will be used for the System ID") |
| 359 | + except: |
| 360 | + mgmt_mac = False |
| 361 | + pS("INFO", "Mgmt Mac Parameter not found. Device MAC Address will be used for the System ID") |
347 | 362 | # Load and Gather network Link information |
348 | 363 | pS("INFO", "Gathering patch cable lengths and quantities...") |
349 | 364 | for _link in links: |
@@ -405,7 +420,7 @@ def main(args): |
405 | 420 | except KeyError: |
406 | 421 | _node_ip = "" |
407 | 422 | _node_name = list(_node.keys())[0] |
408 | | - CEOS[_node_name] = CEOS_NODE(_node_name, _node_ip, _node['mac'], CEOS_LINKS[_node_name], _tag, ceos_image) |
| 423 | + CEOS[_node_name] = CEOS_NODE(_node_name, _node_ip, mgmt_mac, _node['mac'], CEOS_LINKS[_node_name], _tag, ceos_image) |
409 | 424 | DEVICE_INFO.append(f"# {_node_name} = {CEOS[_node_name].tag}{CEOS[_node_name].dev_id}\n") |
410 | 425 | # Load Host nodes specific information |
411 | 426 | if hosts: |
|
0 commit comments