cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
223
Views
1
Helpful
1
Replies

Operational status Interfaces node

Hi,

I'm trying to collect information about status of a leaf for a specific interface and I need operational status and admin status data.

With this simple PY script I collect everything about IF but I can't see operational status, just the administrative one:

 

 

import requests, json

apic_ip = "10.10.20.14"
base_url = f"https://{apic_ip}/api/"

loginfojson = open("logininfo.json", "r")

loginfojsonr = json.load(loginfojson)

login_attributes = loginfojsonr['imdata'][0]['aaaLogin']['attributes']

cookies = {}

cookies['APIC-Cookie'] = login_attributes['token']

request_url = '/mo/topology/pod-1/node-101/sys/phys-[eth1/40].json'

response = requests.request("GET", base_url + request_url, cookies=cookies, verify = False)

with open("ifspecific_out.json", "w") as outputjson:
    outputjson.write(json.dumps(response.json(), indent=4))

 

 

Json result:

 

 

{
    "totalCount": "1",
    "imdata": [
        {
            "l1PhysIf": {
                "attributes": {
                    "adminSt": "up",
                    "autoNeg": "on",
                    "breakT": "nonbroken",
                    "brkoutMap": "none",
                    "bw": "0",
                    "childAction": "",
                    "delay": "1",
                    "descr": "",
                    "dfeDelayMs": "0",
                    "dn": "topology/pod-1/node-101/sys/phys-[eth1/40]",
                    "dot1qEtherType": "0x8100",
                    "emiRetrain": "disable",
                    "enablePoap": "no",
                    "ethpmCfgFailedBmp": "",
                    "ethpmCfgFailedTs": "00:00:00:00.000",
                    "ethpmCfgState": "0",
                    "fcotChannelNumber": "Channel32",
                    "fecMode": "inherit",
                    "id": "eth1/40",
                    "inhBw": "unspecified",
                    "isReflectiveRelayCfgSupported": "Supported",
                    "layer": "Layer2",
                    "lcOwn": "local",
                    "linkDebounce": "100",
                    "linkFlapErrorMax": "30",
                    "linkFlapErrorSeconds": "420",
                    "linkLog": "default",
                    "mdix": "auto",
                    "medium": "broadcast",
                    "modTs": "2024-03-27T06:26:27.556+00:00",
                    "mode": "trunk",
                    "monPolDn": "uni/infra/moninfra-default",
                    "mtu": "9000",
                    "name": "",
                    "pathSDescr": "",
                    "portPhyMediaType": "auto",
                    "portT": "leaf",
                    "prioFlowCtrl": "auto",
                    "reflectiveRelayEn": "off",
                    "routerMac": "not-applicable",
                    "snmpTrapSt": "enable",
                    "spanMode": "not-a-span-dest",
                    "speed": "inherit",
                    "status": "",
                    "switchingSt": "disabled",
                    "trunkLog": "default",
                    "usage": "discovery"
                }
            }
        }
    ]
}

 

 

 How Can I collect operational status information?

Thank you for support,

Cheers

1 Accepted Solution

Accepted Solutions

mfr-6
Level 1
Level 1

hi @greenpepperbreadplum 

Seems like operational status is stored in ethpmPhysIf class.
Example output for this class

 

admin@apic1:~> moquery -d topology/pod-1/node-101/sys/phys-[eth1/25]/phys
Total Objects shown: 1

# ethpm.PhysIf
accessVlan         : vlan-95
allowedVlans       : 92,95
backplaneMac       : XXX
bundleBupId        : 39
bundleIndex        : unspecified
cfgAccessVlan      : vlan-95
cfgNativeVlan      : vlan-95
childAction        : 
currErrIndex       : 2
diags              : none
dn                 : topology/pod-1/node-101/sys/phys-[eth1/25]/phys
encap              : 3
errDisTimerRunning : no
errVlanStatusHt    : 0
errVlans           : 
hwBdId             : 0
hwResourceId       : 0
intfT              : phy
iod                : 29
lastErrors         : 1093795867
lastLinkStChg      : 2024-02-21T15:03:56.575+01:00
media              : 2
modTs              : never
monPolDn           : uni/infra/moninfra-default
nativeVlan         : vlan-95
numOfSI            : 0
operBitset         : 19,35
operDceMode        : edge
operDuplex         : full
operEEERxWkTime    : 0
operEEEState       : not-applicable
operEEETxWkTime    : 0
operErrDisQual     : none
operFecMode        : disable-fec
operFlowCtrl       : 0
operMdix           : auto
operMode           : trunk
operModeDetail     : unknown
operPhyEnSt        : unknown
operRouterMac      : 00:00:00:00:00:00
operSpeed          : unknown
operSt             : down
operStQual         : sfp-missing
operStQualCode     : 0
operVlans          : 
osSum              : failed
portCfgWaitFlags   : 0
primaryVlan        : vlan-1
resetCtr           : 11
rn                 : phys
siList             : 
status             : 
txT                : unknown
usage              : epg
userCfgdFlags      : 1
vdcId              : 1

 


OperSt

 

 

admin@apic1:~> moquery -d topology/pod-1/node-101/sys/phys-[eth1/25]/phys | grep operSt
operSt             : down
operStQual         : sfp-missing
operStQualCode     : 0

admin@apic1:~> moquery -d topology/pod-1/node-101/sys/phys-[eth1/33]/phys | grep operSt
operSt             : up
operStQual         : none
operStQualCode     : 0

 

 You can also preview it using VISORE (object store browser) by using class name "ethpmPhysIf"

mfr6_0-1711782295193.png

 

Mateusz Frak NetDevOps | DevNet | Automation
Please mark this post as helpful if it solves your issue, to make this visible for other users, thank you!

View solution in original post

1 Reply 1

mfr-6
Level 1
Level 1

hi @greenpepperbreadplum 

Seems like operational status is stored in ethpmPhysIf class.
Example output for this class

 

admin@apic1:~> moquery -d topology/pod-1/node-101/sys/phys-[eth1/25]/phys
Total Objects shown: 1

# ethpm.PhysIf
accessVlan         : vlan-95
allowedVlans       : 92,95
backplaneMac       : XXX
bundleBupId        : 39
bundleIndex        : unspecified
cfgAccessVlan      : vlan-95
cfgNativeVlan      : vlan-95
childAction        : 
currErrIndex       : 2
diags              : none
dn                 : topology/pod-1/node-101/sys/phys-[eth1/25]/phys
encap              : 3
errDisTimerRunning : no
errVlanStatusHt    : 0
errVlans           : 
hwBdId             : 0
hwResourceId       : 0
intfT              : phy
iod                : 29
lastErrors         : 1093795867
lastLinkStChg      : 2024-02-21T15:03:56.575+01:00
media              : 2
modTs              : never
monPolDn           : uni/infra/moninfra-default
nativeVlan         : vlan-95
numOfSI            : 0
operBitset         : 19,35
operDceMode        : edge
operDuplex         : full
operEEERxWkTime    : 0
operEEEState       : not-applicable
operEEETxWkTime    : 0
operErrDisQual     : none
operFecMode        : disable-fec
operFlowCtrl       : 0
operMdix           : auto
operMode           : trunk
operModeDetail     : unknown
operPhyEnSt        : unknown
operRouterMac      : 00:00:00:00:00:00
operSpeed          : unknown
operSt             : down
operStQual         : sfp-missing
operStQualCode     : 0
operVlans          : 
osSum              : failed
portCfgWaitFlags   : 0
primaryVlan        : vlan-1
resetCtr           : 11
rn                 : phys
siList             : 
status             : 
txT                : unknown
usage              : epg
userCfgdFlags      : 1
vdcId              : 1

 


OperSt

 

 

admin@apic1:~> moquery -d topology/pod-1/node-101/sys/phys-[eth1/25]/phys | grep operSt
operSt             : down
operStQual         : sfp-missing
operStQualCode     : 0

admin@apic1:~> moquery -d topology/pod-1/node-101/sys/phys-[eth1/33]/phys | grep operSt
operSt             : up
operStQual         : none
operStQualCode     : 0

 

 You can also preview it using VISORE (object store browser) by using class name "ethpmPhysIf"

mfr6_0-1711782295193.png

 

Mateusz Frak NetDevOps | DevNet | Automation
Please mark this post as helpful if it solves your issue, to make this visible for other users, thank you!

Save 25% on Day-2 Operations Add-On License