dainok / netdoc

Automatic Network Documentation plugin for NetBox
GNU General Public License v3.0
89 stars 13 forks source link

NXOS HMM Routes #35

Closed Lurick73 closed 1 year ago

Lurick73 commented 1 year ago

Had to make a couple adjustments to account for HMM routes on NXOS and figured it might be good to bring these into the next release:

IP Route Table for VRF "overlay1"
'*' denotes best ucast next-hop
'**' denotes best mcast next-hop
'[x/y]' denotes [preference/metric]
'%<string>' in via output denotes VRF <string>

0.0.0.0/0, ubest/mbest: 2/0
    *via 10.13.0.1%default, [200/0], 9w5d, bgp-63001, internal, tag 63001, segid: 30001 tunnelid: 0xa0d0001 encap: VXLAN

    *via 10.13.0.9%default, [200/0], 9w5d, bgp-63001, internal, tag 63001, segid: 30001 tunnelid: 0xa0d0009 encap: VXLAN

11.101.0.0/16, ubest/mbest: 1/0, attached
    *via 11.101.0.1, Vlan101, [0/0], 10w0d, direct, tag 12345
11.101.0.1/32, ubest/mbest: 1/0, attached
    *via 11.101.0.1, Vlan101, [0/0], 10w0d, local, tag 12345
11.101.0.10/32, ubest/mbest: 1/0, attached
    *via 11.101.0.10, Vlan101, [190/0], 10w0d, hmm
 {'distance': '190',
  'encap': '',
  'mask': '32',
  'metric': '0',
  'network': '11.101.0.10',
  'nexthop_if': 'Vlan101',
  'nexthop_ip': '11.101.0.10',
  'nexthop_vrf': '',
  'protocol': 'hmm',
  'segid': '',
  'tag': '',
  'tunnelid': '',
  'type': '',
  'uptime': '10w0d',
  'vrf': 'overlay1'}]

/opt/netbox/venv/lib/python3.10/site-packages/netdoc/utils.py:

def normalize_route_type(route_type):
    """Return route type protocol."""
    route_type = route_type.lower()
    **if route_type in ["hmm"]:               
        # Nexus Host Mobility Manager   
        return "hmm"**

/opt/netbox/venv/lib/python3.10/site-packages/netdoc/models.py:

class RouteTypeChoices(ChoiceSet):   
    """Route type."""

    CHOICES = [
        ("u", "Unknown"),
        ("b", "BGP"),               
        ("c", "Connected"),
        ("s", "Static"),
        ("u", "User-space"),
        ("r", "RIP"),
        ("e", "EIGRP"),             
        ("ex", "EIGRP external"),
        ("oia", "OSPF inter area"),    
        ("on1", "OSPF NSSA external type 1"),          
        ("on2", "OSPF NSSA external type 2"),
        ("oe1", "OSPF external type 1"),       
        ("oe2", "OSPF external type 2"),         
        ("i", "IS-IS"),
        ("is", "IS-IS summary"),     
        ("i1", "IS-IS level-1"),       
        ("i2", "IS-IS level-2"),       
        **("hmm", "Host Mobility Manager"),**
dainok commented 1 year ago

I would mark as user-space. I prefer don't have a lot of vendor-specific route type. What do you think?

Lurick73 commented 1 year ago

I would mark as user-space. I prefer don't have a lot of vendor-specific route type. What do you think?

I think that's fair, yes