-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port speed #879
Port speed #879
Changes from 4 commits
8bd272c
965b5fb
0eb6913
e12daee
dcb58a4
7545d41
d49c045
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[ | ||
{% for interface in ethernet_interfaces %} | ||
{ | ||
"PORT_TABLE:{{ interface['name'] }}": { | ||
"speed": "{{ interface['speed'] }}" | ||
}, | ||
"OP": "SET" | ||
}{% if not loop.last %},{% endif %} | ||
|
||
{% endfor %} | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -323,6 +323,17 @@ def parse_meta(meta, hname): | |
deployment_id = value | ||
return syslog_servers, dhcp_servers, ntp_servers, mgmt_routes, erspan_dst, deployment_id | ||
|
||
def parse_deviceinfo(meta, hname): | ||
ethernet_interfaces = [] | ||
|
||
device_info = meta.find(str(QName(ns, "DeviceInfo"))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In DeviceInfos, there are many deviceinfo. You need findall deviceinfo. and for each deviceinfo, you need to find the hwsku and only choose the hwsku that is same as hwsku. |
||
interfaces = device_info.find(str(QName(ns, "EthernetInterfaces"))) | ||
for interface in interfaces.findall(str(QName(ns1, "EthernetInterface"))): | ||
name = interface.find(str(QName(ns, "InterfaceName"))).text | ||
speed = interface.find(str(QName(ns, "Speed"))).text | ||
ethernet_interfaces.append({ 'name':name, 'speed':speed }) | ||
|
||
return ethernet_interfaces | ||
|
||
def get_console_info(devices, dev, port): | ||
for k, v in devices.items(): | ||
|
@@ -409,6 +420,7 @@ def parse_xml(filename, platform=None, port_config_file=None): | |
neighbors = None | ||
devices = None | ||
hostname = None | ||
ethernet_interfaces = [] | ||
syslog_servers = [] | ||
dhcp_servers = [] | ||
ntp_servers = [] | ||
|
@@ -438,6 +450,8 @@ def parse_xml(filename, platform=None, port_config_file=None): | |
(u_neighbors, u_devices, _, _, _, _) = parse_png(child, hostname) | ||
elif child.tag == str(QName(ns, "MetadataDeclaration")): | ||
(syslog_servers, dhcp_servers, ntp_servers, mgmt_routes, erspan_dst, deployment_id) = parse_meta(child, hostname) | ||
elif child.tag == str(QName(ns, "DeviceInfos")): | ||
ethernet_interfaces = parse_deviceinfo(child, hostname) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. change to parse_deviceinfo(child, hwsku) |
||
|
||
results = {} | ||
results['minigraph_hwsku'] = hwsku | ||
|
@@ -486,6 +500,7 @@ def parse_xml(filename, platform=None, port_config_file=None): | |
results['forced_mgmt_routes'] = mgmt_routes | ||
results['erspan_dst'] = erspan_dst | ||
results['deployment_id'] = deployment_id | ||
results['ethernet_interfaces'] = ethernet_interfaces | ||
|
||
return results | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -200,6 +200,65 @@ | |
</Device> | ||
</Devices> | ||
</PngDec> | ||
<DeviceInfos> | ||
<DeviceInfo> | ||
<AutoNegotiation>true</AutoNegotiation> | ||
<EthernetInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"> | ||
<a:EthernetInterface> | ||
<ElementType>DeviceInterface</ElementType> | ||
<AlternateSpeeds i:nil="true"/> | ||
<EnableAutoNegotiation>true</EnableAutoNegotiation> | ||
<EnableFlowControl>true</EnableFlowControl> | ||
<Index>1</Index> | ||
<InterfaceName>Ethernet0</InterfaceName> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. -> fortyGigE0/0 |
||
<InterfaceType i:nil="true"/> | ||
<MultiPortsInterface>false</MultiPortsInterface> | ||
<PortName>0</PortName> | ||
<Priority>0</Priority> | ||
<Speed>10000</Speed> | ||
</a:EthernetInterface> | ||
<a:EthernetInterface> | ||
<ElementType>DeviceInterface</ElementType> | ||
<AlternateSpeeds i:nil="true"/> | ||
<EnableAutoNegotiation>true</EnableAutoNegotiation> | ||
<EnableFlowControl>true</EnableFlowControl> | ||
<Index>1</Index> | ||
<InterfaceName>Ethernet4</InterfaceName> | ||
<InterfaceType i:nil="true"/> | ||
<MultiPortsInterface>false</MultiPortsInterface> | ||
<PortName>0</PortName> | ||
<Priority>0</Priority> | ||
<Speed>25000</Speed> | ||
</a:EthernetInterface> | ||
<a:EthernetInterface> | ||
<ElementType>DeviceInterface</ElementType> | ||
<AlternateSpeeds i:nil="true"/> | ||
<EnableAutoNegotiation>true</EnableAutoNegotiation> | ||
<EnableFlowControl>true</EnableFlowControl> | ||
<Index>1</Index> | ||
<InterfaceName>Ethernet8</InterfaceName> | ||
<InterfaceType i:nil="true"/> | ||
<MultiPortsInterface>false</MultiPortsInterface> | ||
<PortName>0</PortName> | ||
<Priority>0</Priority> | ||
<Speed>40000</Speed> | ||
</a:EthernetInterface> | ||
<a:EthernetInterface> | ||
<ElementType>DeviceInterface</ElementType> | ||
<AlternateSpeeds i:nil="true"/> | ||
<EnableAutoNegotiation>true</EnableAutoNegotiation> | ||
<EnableFlowControl>true</EnableFlowControl> | ||
<Index>1</Index> | ||
<InterfaceName>Ethernet12</InterfaceName> | ||
<InterfaceType i:nil="true"/> | ||
<MultiPortsInterface>false</MultiPortsInterface> | ||
<PortName>0</PortName> | ||
<Priority>0</Priority> | ||
<Speed>1000000</Speed> | ||
</a:EthernetInterface> | ||
</EthernetInterfaces> | ||
</DeviceInfo> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add hwsku in the deviceinfo
|
||
</DeviceInfos> | ||
<Hostname>switch-t0</Hostname> | ||
<HwSku>Force10-S6000</HwSku> | ||
</DeviceMiniGraph> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change hname to hwsku