10-17-2019 07:59 AM
Hello,
I’ve been trying to get a list of the VLANs on a VSP device.
The device is a VSP-8404 with 6.1.6.0 firmware, and the XMC version is 8.2.4.55.
I know of two ways to get them.
The first one would be to send a CLI command with emc_cli, and get the output, then filter it to get a list.
cli_output = emc_cli.send("show vlan basic").getOutput().encode('ascii', 'ignore')
The second one is using emc_nbi and sending a query to get the VLANs ID
var_query = '''query{network{device(ip: "DeviceIP"){deviceData{vlans{vid}}}}}'''
var_result = emc_nbi.query(var_query)
vlans_id = var_result['network']['device']['deviceData']['vlans']
But, I noticed that using NBI doesn’t give me the same result as using CLI.
With CLI, I get this list : 1, 2, 49, 170, 180, 190, 4049, 4051, 4052
With NBI, I get this list : 1, 2, 49, 170, 180, 666, 4049
The NBI is not correct, as I don’t get the 190, 4051 and 4052, and it adds the 666.
I don’t understand why this difference is present. Is there something I’m doing wrong ?
Thanks a lot for the help
Solved! Go to Solution.
10-17-2019 09:01 PM
Hey everyone,
I had the same problem with the NBI and, together with GTAC, found out that refreshing the device with a mutation and querying the right context within the NBI solves it - at least for EXOS and EOS. Try this (replace the IP with the management IP of the switch in question):
mutation {
network {
rediscoverDevices(input: {devices: [{ipAddress: "10.0.0.1"}]}) {
status
message
}
}
}
After firing this mutation, wait for 15 minutes (or check the Operations view) and try the following GraphiQL query (again, replace the IP).
query {
network {
deviceVlans(ip: "10.0.0.1") {
name
vid
primaryIp
netmask
ipForward
}
}
}
See https://link.medium.com/m5yqUU15y0 for an in-depth story on that topic.
10-18-2019 07:19 AM
Thanks a lot for providing a solution BCN-rbrt !
By any chance, do you know what a mutation does ? Does it change anything on the device, or something like that ?
Because, I’d like to be sure it doesn’t affect the network before implemanting a workflow that uses a mutation.
10-17-2019 09:01 PM
Hey everyone,
I had the same problem with the NBI and, together with GTAC, found out that refreshing the device with a mutation and querying the right context within the NBI solves it - at least for EXOS and EOS. Try this (replace the IP with the management IP of the switch in question):
mutation {
network {
rediscoverDevices(input: {devices: [{ipAddress: "10.0.0.1"}]}) {
status
message
}
}
}
After firing this mutation, wait for 15 minutes (or check the Operations view) and try the following GraphiQL query (again, replace the IP).
query {
network {
deviceVlans(ip: "10.0.0.1") {
name
vid
primaryIp
netmask
ipForward
}
}
}
See https://link.medium.com/m5yqUU15y0 for an in-depth story on that topic.
10-17-2019 09:00 AM
I cannot help with why XMC doesn’t retrieve the full, correct list of VLANs from those devices. Maybe someone else reading this can? But yeah, the emc_cli will give you the definitive answer on which VLANs actually exist on a switch since it is executing this CLI command on that switch.
10-17-2019 08:53 AM
Hi Kurt,
As both queries’ sources are different, I guess we can say that as emc_cli queries the switch, it is the correct one ?
And I don’t know why XMC doesn’t have the correct list of VLANs.
I checked with either ERS or VSP, with different firmware versions, the list I get with NBI is never correct.
Is there something I can do to help ?
10-17-2019 08:35 AM
Hi Nealo,
those two methods retrieve data from two different sources:
The question now is: why does XMC not have the correct list of VLANs for that switch?