Skip to content

Instantly share code, notes, and snippets.

@mirceaulinic
Created October 18, 2016 04:14
Show Gist options
  • Save mirceaulinic/1309b3b11aaac34e5c996c9338043eb5 to your computer and use it in GitHub Desktop.
Save mirceaulinic/1309b3b11aaac34e5c996c9338043eb5 to your computer and use it in GitHub Desktop.
Request-reply for interfaces OC
>>> dev.rpc.get('<interfaces xmlns="http://openconfig.net/yang/interfaces"/>')
{u'data': {u'interfaces': {u'interface': [{u'ethernet': {u'state': {u'auto-negotiate': u'false', u'hw-mac-address': u'08:00:27:81:71:e8', u'counters': {u'in-fragment-frames': u'0', u'in-oversize-frames': u'0', u'in-8021q-frames': u'0', u'out-8021q-frames': u'0', u'in-mac-pause-frames': u'0', u'in-jabber-frames': u'0', u'in-crc-errors': u'0', u'out-mac-pause-frames': u'0'}}, u'config': {u'auto-negotiate': u'false'}}, u'state': {u'name': u'MgmtEth0/RP0/CPU0/0', u'oper-status': u'UP', u'enabled': u'true', u'admin-status': u'UP', u'mtu': u'1514', u'ifindex': u'7', u'last-change': u'381', u'counters': {u'out-octets': u'2030950', u'out-errors': u'0', u'in-multicast-pkts': u'0', u'out-broadcast-pkts': u'0', u'in-errors': u'0', u'out-multicast-pkts': u'0', u'in-discards': u'0', u'last-clear': u'Never', u'in-unicast-pkts': u'12773', u'out-unicast-pkts': u'7933', u'out-discards': u'0', u'in-broadcast-pkts': u'2', u'in-unknown-protos': u'0', u'in-octets': u'2157029'}, u'type': u'idx:ethernetCsmacd', u'description': u''}, u'config': {u'enabled': u'true', u'type': u'idx:ethernetCsmacd', u'name': u'MgmtEth0/RP0/CPU0/0'}, u'name': u'MgmtEth0/RP0/CPU0/0', u'subinterfaces': {u'subinterface': {u'index': u'0', u'ipv4': {u'neighbor': [{u'ip': u'10.0.2.2', u'state': {u'origin': u'DYNAMIC', u'ip': u'10.0.2.2', u'link-layer-address': u'52:54:00:12:35:02'}}, {u'ip': u'10.0.2.15', u'state': {u'origin': u'OTHER', u'ip': u'10.0.2.15', u'link-layer-address': u'08:00:27:81:71:e8'}}]}}}}, {u'ethernet': {u'state': {u'auto-negotiate': u'false', u'hw-mac-address': u'08:00:27:cf:45:0e', u'counters': {u'in-fragment-frames': u'0', u'in-oversize-frames': u'0', u'in-8021q-frames': u'0', u'out-8021q-frames': u'0', u'in-mac-pause-frames': u'0', u'in-jabber-frames': u'0', u'in-crc-errors': u'0', u'out-mac-pause-frames': u'0'}}, u'config': {u'auto-negotiate': u'false'}}, u'state': {u'name': u'GigabitEthernet0/0/0/0', u'oper-status': u'DOWN', u'enabled': u'false', u'mtu': u'1514', u'type': u'idx:ethernetCsmacd', u'ifindex': u'3', u'last-change': u'480', u'counters': {u'out-octets': u'0', u'out-errors': u'0', u'in-multicast-pkts': u'0', u'out-broadcast-pkts': u'0', u'in-errors': u'0', u'out-multicast-pkts': u'0', u'in-discards': u'0', u'last-clear': u'Never', u'in-unicast-pkts': u'0', u'out-unicast-pkts': u'0', u'out-discards': u'0', u'in-broadcast-pkts': u'0', u'in-unknown-protos': u'0', u'in-octets': u'0'}, u'admin-status': u'DOWN', u'description': u''}, u'config': {u'enabled': u'false', u'type': u'idx:ethernetCsmacd', u'name': u'GigabitEthernet0/0/0/0'}, u'name': u'GigabitEthernet0/0/0/0'}, {u'ethernet': {u'state': {u'auto-negotiate': u'false', u'hw-mac-address': u'08:00:27:d2:ce:42', u'counters': {u'in-fragment-frames': u'0', u'in-oversize-frames': u'0', u'in-8021q-frames': u'0', u'out-8021q-frames': u'0', u'in-mac-pause-frames': u'0', u'in-jabber-frames': u'0', u'in-crc-errors': u'0', u'out-mac-pause-frames': u'0'}}, u'config': {u'auto-negotiate': u'false'}}, u'state': {u'name': u'GigabitEthernet0/0/0/1', u'oper-status': u'DOWN', u'enabled': u'false', u'admin-status': u'DOWN', u'mtu': u'1514', u'ifindex': u'4', u'last-change': u'480', u'counters': {u'out-octets': u'0', u'out-errors': u'0', u'in-multicast-pkts': u'0', u'out-broadcast-pkts': u'0', u'in-errors': u'0', u'out-multicast-pkts': u'0', u'in-discards': u'0', u'last-clear': u'Never', u'in-unicast-pkts': u'0', u'out-unicast-pkts': u'0', u'out-discards': u'0', u'in-broadcast-pkts': u'0', u'in-unknown-protos': u'0', u'in-octets': u'0'}, u'type': u'idx:ethernetCsmacd', u'description': u''}, u'config': {u'enabled': u'false', u'type': u'idx:ethernetCsmacd', u'name': u'GigabitEthernet0/0/0/1'}, u'name': u'GigabitEthernet0/0/0/1'}, {u'ethernet': {u'state': {u'auto-negotiate': u'false', u'hw-mac-address': u'08:00:27:70:f6:cf', u'counters': {u'in-fragment-frames': u'0', u'in-oversize-frames': u'0', u'in-8021q-frames': u'0', u'out-8021q-frames': u'0', u'in-mac-pause-frames': u'0', u'in-jabber-frames': u'0', u'in-crc-errors': u'0', u'out-mac-pause-frames': u'0'}}, u'config': {u'auto-negotiate': u'false'}}, u'state': {u'name': u'GigabitEthernet0/0/0/2', u'oper-status': u'DOWN', u'enabled': u'false', u'admin-status': u'DOWN', u'mtu': u'1514', u'ifindex': u'5', u'last-change': u'480', u'counters': {u'out-octets': u'0', u'out-errors': u'0', u'in-multicast-pkts': u'0', u'out-broadcast-pkts': u'0', u'in-errors': u'0', u'out-multicast-pkts': u'0', u'in-discards': u'0', u'last-clear': u'Never', u'in-unicast-pkts': u'0', u'out-unicast-pkts': u'0', u'out-discards': u'0', u'in-broadcast-pkts': u'0', u'in-unknown-protos': u'0', u'in-octets': u'0'}, u'type': u'idx:ethernetCsmacd', u'description': u''}, u'config': {u'enabled': u'false', u'type': u'idx:ethernetCsmacd', u'name': u'GigabitEthernet0/0/0/2'}, u'name': u'GigabitEthernet0/0/0/2'}, {u'ethernet': {u'state': {u'auto-negotiate': u'false', u'hw-mac-address': u'08:00:27:87:41:5a', u'counters': {u'in-fragment-frames': u'0', u'in-oversize-frames': u'0', u'in-8021q-frames': u'0', u'out-8021q-frames': u'0', u'in-mac-pause-frames': u'0', u'in-jabber-frames': u'0', u'in-crc-errors': u'0', u'out-mac-pause-frames': u'0'}}, u'config': {u'auto-negotiate': u'false'}}, u'state': {u'name': u'GigabitEthernet0/0/0/3', u'oper-status': u'DOWN', u'enabled': u'false', u'admin-status': u'DOWN', u'mtu': u'1514', u'ifindex': u'6', u'last-change': u'480', u'counters': {u'out-octets': u'0', u'out-errors': u'0', u'in-multicast-pkts': u'0', u'out-broadcast-pkts': u'0', u'in-errors': u'0', u'out-multicast-pkts': u'0', u'in-discards': u'0', u'last-clear': u'Never', u'in-unicast-pkts': u'0', u'out-unicast-pkts': u'0', u'out-discards': u'0', u'in-broadcast-pkts': u'0', u'in-unknown-protos': u'0', u'in-octets': u'0'}, u'type': u'idx:ethernetCsmacd', u'description': u''}, u'config': {u'enabled': u'false', u'type': u'idx:ethernetCsmacd', u'name': u'GigabitEthernet0/0/0/3'}, u'name': u'GigabitEthernet0/0/0/3'}, {u'state': {u'description': u'', u'oper-status': u'UP', u'mtu': u'1500', u'type': u'idx:other', u'ifindex': u'2', u'last-change': u'437', u'admin-status': u'UP', u'counters': {u'out-errors': u'0', u'in-multicast-pkts': u'0', u'out-broadcast-pkts': u'0', u'in-errors': u'0', u'out-multicast-pkts': u'0', u'in-discards': u'0', u'last-clear': u'Never', u'out-discards': u'0', u'in-broadcast-pkts': u'0', u'in-unknown-protos': u'0'}}, u'name': u'Null0'}]}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment