jmespath / jmespath/jmespath.site

Check multiple conditions for all keys, in the given nested dictionary using jmespath

Open
#86 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Makefile
Stars
61
Forks
61
PR merge metrics
No merged PRs in 30d

Description

Hi

I am completely new to jmespath. I've been trying to check conditions if for ALL nodes, ('Config state '=='NSHUT' and ('State '=='OPERATIONAL' or 'State '=='IOS XR RUN')). I am expecting a single Boolean value after the check. Following is the nested dictionary I'm trying this on:

{
"0/0/1": {
"Config state ": "",
"Node ": "0/0/1",
"State ": "OK",
"Type ": "NC55-MPA-12T-S"
},
"0/0/CPU0": {
"Config state ": "NSHUT",
"Node ": "0/0/CPU0",
"State ": "IOS XR RUN",
"Type ": "NC55-MOD-A-S"
},
"0/0/NPU0": {
"Config state ": "",
"Node ": "0/0/NPU0",
"State ": "UP",
"Type ": "Slice"
},
"0/FC0": {
"Config state ": "NSHUT",
"Node ": "0/FC0",
"State ": "OPERATIONAL",
"Type ": "NC55-5508-FC"
},
"0/FC1": {
"Config state ": "NSHUT",
"Node ": "0/FC1",
"State ": "OPERATIONAL",
"Type ": "NC55-5508-FC"
},
"0/FC2": {
"Config state ": "NSHUT",
"Node ": "0/FC2",
"State ": "OPERATIONAL",
"Type ": "NC55-5508-FC"
},
"0/FC3": {
"Config state ": "NSHUT",
"Node ": "0/FC3",
"State ": "OPERATIONAL",
"Type ": "NC55-5508-FC"
},
"0/FC4": {
"Config state ": "NSHUT",
"Node ": "0/FC4",
"State ": "OPERATIONAL",
"Type ": "NC55-5508-FC"
},
"0/FC5": {
"Config state ": "NSHUT",
"Node ": "0/FC5",
"State ": "OPERATIONAL",
"Type ": "NC55-5508-FC"
},
"0/FT0": {
"Config state ": "NSHUT",
"Node ": "0/FT0",
"State ": "OPERATIONAL",
"Type ": "NC55-5508-FAN"
},
"0/FT1": {
"Config state ": "NSHUT",
"Node ": "0/FT1",
"State ": "OPERATIONAL",
"Type ": "NC55-5508-FAN"
},
"0/FT2": {
"Config state ": "NSHUT",
"Node ": "0/FT2",
"State ": "OPERATIONAL",
"Type ": "NC55-5508-FAN"
},
"0/PM0": {
"Config state ": "NSHUT",
"Node ": "0/PM0",
"State ": "OPERATIONAL",
"Type ": "NC55-PWR-3KW-DC"
},
"0/PM1": {
"Config state ": "NSHUT",
"Node ": "0/PM1",
"State ": "OPERATIONAL",
"Type ": "NC55-PWR-3KW-DC"
},
"0/PM2": {
"Config state ": "NSHUT",
"Node ": "0/PM2",
"State ": "OPERATIONAL",
"Type ": "NC55-PWR-3KW-DC"
},
"0/PM3": {
"Config state ": "NSHUT",
"Node ": "0/PM3",
"State ": "FAILED",
"Type ": "NC55-PWR-3KW-DC"
},
"0/RP0/CPU0": {
"Config state ": "NSHUT",
"Node ": "0/RP0/CPU0",
"State ": "IOS XR RUN",
"Type ": "NC55-RP-E(Active)"
},
"0/RP1": {
"Config state ": "NSHUT",
"Node ": "0/RP1",
"State ": "SW_INACTIVE",
"Type ": "NC55-RP-E"
},
"0/SC0": {
"Config state ": "NSHUT",
"Node ": "0/SC0",
"State ": "OPERATIONAL",
"Type ": "NC55-SC"
},
"0/SC1": {
"Config state ": "NSHUT",
"Node ": "0/SC1",
"State ": "OPERATIONAL",
"Type ": "NC55-SC"
}
}

Please help!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.