esnet / sense-rtmon

Custom Scripts for Dynamic End-To-End Flow-Specific Grafana Dashboards
5 stars 4 forks source link

template query updated (ipv6,mac of switch-ports) #109

Closed juztas closed 3 weeks ago

juztas commented 5 months ago

Current template:

{"Ports": [{
            "Port": "?terminal?",
            "Name": "?port_name?",
            "Vlan": "?vlan?",
            "Node": "?node_name?",
            "Peer": "?peer?",
            "Site": "?site?",
            "Host": [{
                "Interface": "?host_port_name?",
                "Name": "?host_name?",
                "IPv4": "?ipv4?",
                "IPv6": "?ipv6?",
                "MAC": "?mac?",
                "sparql": "SELECT DISTINCT ?host_port ?ipv4 ?ipv6 ?mac WHERE { ?vlan_port nml:isAlias ?host_vlan_port. ?host_port nml:hasBidirectionalPort ?host_vlan_port. OPTIONAL {?host_vlan_port mrs:hasNetworkAddress  ?ipv4na. ?ipv4na mrs:type \"ipv4-address\". ?ipv4na mrs:value ?ipv4.} OPTIONAL {?host_vlan_port mrs:hasNetworkAddress  ?ipv6na. ?ipv6na mrs:type \"ipv6-address\". ?ipv6na mrs:value ?ipv6.} OPTIONAL {?host_vlan_port mrs:hasNetworkAddress  ?macna. ?macna mrs:type \"mac-address\". ?macna mrs:value ?mac.} FILTER NOT EXISTS {?sw_svc mrs:providesSubnet ?vlan_subnt. ?vlan_subnt nml:hasBidirectionalPort ?host_vlan_port.} }",
                "sparql-ext": "SELECT DISTINCT ?host_name ?host_port_name  WHERE {?host a nml:Node. ?host nml:hasBidirectionalPort ?host_port. OPTIONAL {?host nml:name ?host_name.} OPTIONAL {?host_port mrs:hasNetworkAddress ?na_pn. ?na_pn mrs:type \"sense-rtmon:name\". ?na_pn mrs:value ?host_port_name.} }",
                "required": "false"
            }],
            "sparql": "SELECT DISTINCT ?vlan_port ?vlan WHERE { ?subnet a mrs:SwitchingSubnet. ?subnet nml:hasBidirectionalPort ?vlan_port. ?vlan_port nml:hasLabel ?vlan_l. ?vlan_l nml:value ?vlan. }",
            "sparql-ext": "SELECT DISTINCT ?terminal ?port_name ?node_name ?peer ?site WHERE { {?node a nml:Node. ?node nml:name ?node_name. ?node nml:hasBidirectionalPort ?terminal.  ?terminal nml:hasBidirectionalPort ?vlan_port. OPTIONAL {?terminal mrs:hasNetworkAddress ?na_pn. ?na_pn mrs:type \"sense-rtmon:name\". ?na_pn mrs:value ?port_name.} OPTIONAL {?terminal nml:isAlias ?peer.} OPTIONAL {?site nml:hasNode ?node.} OPTIONAL {?site nml:hasTopology ?sub_site. ?sub_site nml:hasNode ?node.} } UNION { ?site a nml:Topology. ?site nml:name ?node_name. ?site nml:hasBidirectionalPort ?terminal. ?terminal nml:hasBidirectionalPort ?vlan_port. OPTIONAL {?terminal mrs:hasNetworkAddress ?na_pn. ?na_pn mrs:type \"sense-rtmon:name\". ?na_pn mrs:value ?port_name.} OPTIONAL {?terminal nml:isAlias ?peer.}}}",
            "required": "true"
        }]}

Need to include the following info (ipv6 address/mac address of switch port ):

<urn:ogf:network:ultralight.org:2013:dellos9_s0:Port-channel_103:conn+f3ce2f02-b198-42d7-8bf5-780f3ff0cd66:vt+l2-policy-Connection_1:vlanport+3615:ipv6-address+fc00_1786_0_0_0_0_0_1_64> a mrs:NetworkAddress ;
    mrs:tag "Connection_1::Connection_1" ;
    mrs:type "ipv6-address",
        "unverifiable" ;
    mrs:value "fc00:1786:0:0:0:0:0:1/64" .
<urn:ogf:network:ultralight.org:2013:dellos9_s0:Port-channel_103:conn+f3ce2f02-b198-42d7-8bf5-780f3ff0cd66:vt+l2-policy-Connection_1:vlanport+3615:mac-address+4c__76__25__e8__44__c2> a mrs:NetworkAddress ;
    mrs:type "mac-address" ;
    mrs:value "4c:76:25:e8:44:c2" .

@xi-yang could you take a look into this?

xi-yang commented 5 months ago

This template assumes we only have addresses on host interfaces. I think that is all that RTMON needs. If there will be a use case for having IP/MAC address monitored on the switch ports, we do a design on that use case and then deal with that as a future feature.

juztas commented 3 months ago

The following query: https://github.com/esnet/sense-rtmon/blob/main/autogole-api/src/python/RTMonLibs/SenseAPI.py#L49-L69

Produces this output:

{'Ports': [{'Name': 'Port-channel 102',
            'Node': 'T2_US_Caltech:dellos10_s0',
            'Peer': 'urn:ogf:network:sc-test.cenic.net:2020:aristaeos_s0:Port-Channel501',
            'Port': 'urn:ogf:network:tier2.ultralight.org:2024:dellos10_s0:Port-channel_102',
            'Site': 'urn:ogf:network:tier2.ultralight.org:2024',
            'Vlan': '1788'},
           {'Name': 'Port-channel 101',
            'Node': 'T2_US_Caltech:dellos10_s0',
            'Peer': 'urn:ogf:network:ultralight.org:2013:dellos9_s0:Port-channel_103',
            'Port': 'urn:ogf:network:tier2.ultralight.org:2024:dellos10_s0:Port-channel_101',
            'Site': 'urn:ogf:network:tier2.ultralight.org:2024',
            'Vlan': '1788'},
           {'Name': 'Port-Channel502',
            'Node': 'NRM_CENIC:aristaeos_s0',
            'Peer': 'urn:ogf:network:sense-oasis-nrp-nautilus.io:2020:oasis:Pc502',
            'Port': 'urn:ogf:network:sc-test.cenic.net:2020:aristaeos_s0:Port-Channel502',
            'Site': 'urn:ogf:network:sc-test.cenic.net:2020',
            'Vlan': '1788'},
           {'Name': 'Port-Channel501',
            'Node': 'NRM_CENIC:aristaeos_s0',
            'Peer': 'urn:ogf:network:tier2.ultralight.org:2024:dellos10_s0:Port-channel_102',
            'Port': 'urn:ogf:network:sc-test.cenic.net:2020:aristaeos_s0:Port-Channel501',
            'Site': 'urn:ogf:network:sc-test.cenic.net:2020',
            'Vlan': '1788'},
           {'Name': 'PortChannel502',
            'Node': 'T2_US_SDSC:sn3700_s0',
            'Peer': 'urn:ogf:network:nrp-nautilus.io:2020:edgecore_s0:PortChannel502',
            'Port': 'urn:ogf:network:nrp-nautilus.io:2020:sn3700_s0:PortChannel502',
            'Site': 'urn:ogf:network:nrp-nautilus.io:2020',
            'Vlan': '1788'},
           {'Name': 'Pc502',
            'Node': 'T2_US_UCSD_OASIS:oasis',
            'Peer': 'urn:ogf:network:sc-test.cenic.net:2020:aristaeos_s0:Port-Channel502',
            'Port': 'urn:ogf:network:sense-oasis-nrp-nautilus.io:2020:oasis:Pc502',
            'Site': 'urn:ogf:network:sense-oasis-nrp-nautilus.io:2020',
            'Vlan': '1788'},
           {'Name': 'Pc500',
            'Node': 'T2_US_UCSD_OASIS:oasis',
            'Peer': 'urn:ogf:network:nrp-nautilus.io:2020:edgecore_s0:PortChannel500',
            'Port': 'urn:ogf:network:sense-oasis-nrp-nautilus.io:2020:oasis:Pc500',
            'Site': 'urn:ogf:network:sense-oasis-nrp-nautilus.io:2020',
            'Vlan': '1788'},
           {'Name': 'Port-channel 103',
            'Node': 'T2_US_Caltech_Test:dellos9_s0',
            'Peer': 'urn:ogf:network:tier2.ultralight.org:2024:dellos10_s0:Port-channel_101',
            'Port': 'urn:ogf:network:ultralight.org:2013:dellos9_s0:Port-channel_103',
            'Site': 'urn:ogf:network:ultralight.org:2013',
            'Vlan': '1788'},
           {'Name': 'PortChannel500',
            'Node': 'T2_US_SDSC:edgecore_s0',
            'Peer': 'urn:ogf:network:sense-oasis-nrp-nautilus.io:2020:oasis:Pc500',
            'Port': 'urn:ogf:network:nrp-nautilus.io:2020:edgecore_s0:PortChannel500',
            'Site': 'urn:ogf:network:nrp-nautilus.io:2020',
            'Vlan': '1788'},
           {'Name': 'PortChannel502',
            'Node': 'T2_US_SDSC:edgecore_s0',
            'Peer': 'urn:ogf:network:nrp-nautilus.io:2020:sn3700_s0:PortChannel502',
            'Port': 'urn:ogf:network:nrp-nautilus.io:2020:edgecore_s0:PortChannel502',
            'Site': 'urn:ogf:network:nrp-nautilus.io:2020',
            'Vlan': '1788'}]}

Would be nice to extend it to include ipv6-address and mac-address. The following request provisioned on sense-o-dev: d1d76373-bd8d-4893-8aaf-a66405aa9224 @xi-yang could you help me on this to extend and include switch/router ipv6-address and mac-address in query?

xi-yang commented 3 months ago

The query only fetches the ip and mac addresses for host vlan ports. None of the above is a host port.

We may add Mac address for switch ports. But most switches have no Mac address in the model.

juztas commented 3 months ago

Most SiteRMs (with switch control) are exposing mac-address for each port (in many cases it is the same, but on some devices they have diff based on port, for example:

<urn:ogf:network:ultralight.org:2013:dellos9_s0:Port-channel_103:mac-address+4c__76__25__e8__44__c2> a mrs:NetworkAddress ;
    mrs:type "mac-address" ;
    mrs:value "4c:76:25:e8:44:c2" .

Is this not right format? I could change that if needed.

xi-yang commented 3 months ago

Since the service instance is for a path of VLAN ports, do we want to expose the physical ports MAC? I understand sometimes they are the same but not always.

juztas commented 3 months ago

Do you see an issue exposing the physical port mac address?

xi-yang commented 3 months ago

Do you see an issue exposing the physical port mac address?

Not really for RTMON. For SENSE-O portal add-on, we will limit the manifest to only show model information within the instance.

juztas commented 3 months ago

All updated here: https://github.com/esnet/sense-rtmon/issues/114#issuecomment-2254185452.

Action items now:

juztas commented 2 months ago

First 2 action items done here: https://github.com/esnet/sense-rtmon/pull/129

juztas commented 3 weeks ago

https://github.com/esnet/sense-rtmon/commit/c9f314c01a03de12d1d4ba467525fdf35401ecd4 - Pings added here