open-switch / opx-cps

https://openswitch.net
6 stars 15 forks source link

Query interface configuration by type broken #79

Closed james-jra closed 6 years ago

james-jra commented 6 years ago

I've just updated an OPX 2.3 machine (apt-get update && apt-get upgrade) After this update, querying interface configuration by interface type no longer works - it always returns the full list of interfaces. Querying by name or interface-index still works.

Before the update, I could query all configuration for VLAN interfaces, as shown below:

root@OPX:~# sudo cps_get_oid.py dell-base-if-cmn/if/interfaces/interface if/interfaces/interface/type=ianaift:l2vlan

============dell-base-if-cmn/if/interfaces/interface==========

dell-base-if-cmn/if/interfaces/interface/if-index = 37
dell-if/if/interfaces/interface/phys-address = ec:f4:bb:fd:43:c6
if/interfaces/interface/type = ianaift:l2vlan
base-if-vlan/if/interfaces/interface/id = 100
if/interfaces/interface/name = br100
dell-if/if/interfaces/interface/vlan-type = 1
dell-if/if/interfaces/interface/learning-mode = 1
dell-if/if/interfaces/interface/mtu = 1532
if/interfaces/interface/enabled = 0
------------------------------------------------

Now, the same command returns all interfaces of any type:

root@OPX:~# sudo cps_get_oid.py dell-base-if-cmn/if/interfaces/interface if/interfaces/interface/type=ianaift:l2vlan

============dell-base-if-cmn/if/interfaces/interface==========

dell-base-if-cmn/if/interfaces/interface/if-index = 4
if/interfaces/interface/type = base-if:cpu
if/interfaces/interface/name = npu-0
------------------------------------------------
.
.
.
if/interfaces/interface/type = ianaift:ethernetCsmacd
dell-if/if/interfaces/interface/mode = 1
base-if-phy/if/interfaces/interface/port-id = 125
dell-if/if/interfaces-state/interface/supported-speed = 3,4,6
dell-if/if/interfaces/interface/mtu = 1532
base-if-phy/if/interfaces/interface/phy-media = 1
if/interfaces/interface/enabled = 0
base-if-phy/if/interfaces/interface/tagging-mode = 3
------------------------------------------------
dell-base-if-cmn/if/interfaces/interface/if-index = 37
dell-if/if/interfaces/interface/phys-address = ec:f4:bb:fd:53:e6
if/interfaces/interface/type = ianaift:l2vlan
base-if-vlan/if/interfaces/interface/id = 100
if/interfaces/interface/name = br100
dell-if/if/interfaces/interface/vlan-type = 1
dell-if/if/interfaces/interface/learning-mode = 1
dell-if/if/interfaces/interface/mtu = 1532
if/interfaces/interface/enabled = 0
------------------------------------------------

The packages which changed in the update were:

hpersh commented 6 years ago

The 'type' field of the interface object is not a key field (see RFC 2863). Therefore, the application should request all interface objects, and filter those whose type is 'vlan'.

jeff-yin commented 6 years ago

Hi @james-jra -- I have to ask, but did you reboot the system after the "apt-get upgrade" operation?

atanu-mandal commented 6 years ago

As we have provided the support for "type" based query for the interfaces, it should work. Can you please check whether you have rebooted the switch after the upgrade. Also I would suggest to use dist-upgrade instead of upgrade. Also please refer "Upgrading OpenSwitch" section at https://archive.openswitch.net/docs/2.3.0/openswitch_opx_230_release_notes.pdf

james-jra commented 6 years ago

@hpersh I agree that the 'type' field is not a key field, and I am happy to have the application implement this filtering if this is no longer supported in CPS. However, as Atanu has said, the CPS API has historically supported the 'type' based query for interfaces. and I would be alarmed if this has been intentionally removed without being documented anywhere (like package changelogs). Especially since the following three utility scripts included in OPX rely on the 'type' based query for interfaces:

Just in case you do need to address this issue, I've provided more information to help your investigation below:

@atanu-mandal Yes, I did reboot the switch. I've tried this three times now

Reproduction using OPX 2.3.0-dev1 VM

I'm running the VM in VirtualBox using Vagrant, with the following Vagrantfile. I start with a clean virtual machine.

Vagrant.configure("2") do |config|
  config.ssh.username = "opxUser"
  config.vm.box = "opx/2.3.0-dev1"
  config.vm.box_version = "2.3.0-dev1"
end

============dell-base-if-cmn/if/interfaces/interface==========

dell-base-if-cmn/if/interfaces/interface/if-index = 39 dell-if/if/interfaces/interface/phys-address = 08:00:27:55:26:d5 if/interfaces/interface/type = ianaift:l2vlan base-if-vlan/if/interfaces/interface/id = 100 if/interfaces/interface/name = br100 dell-if/if/interfaces/interface/vlan-type = 1 dell-if/if/interfaces/interface/learning-mode = 1 dell-if/if/interfaces/interface/mtu = 1532 if/interfaces/interface/enabled = 0

* Update & upgrade:

opxUser@opx23_vm:~$ sudo apt-get update && sudo apt-get dist-upgrade

# To see what happened, look at the relevant part of /var/log/apt/history.log opxUser@opx23_vm:~$ sudo cat /var/log/apt/history.log . . . Start-Date: 2018-03-28 08:28:57 Commandline: apt-get dist-upgrade Install: python-opx-snmp:amd64 (1.0.3, automatic) Upgrade: libopx-nas-interface1:amd64 (5.10.1+opx8, 5.10.1+opx11), libopx-nas-linux1:amd64 (5.11.0+opx3, 5.11.0+opx4), opx-nas-acl:amd64 (2.4.0+opx2, 2.4.0+opx3), libicu52:amd64 (52.1-8+deb8u6, 52.1-8+deb8u7), libopx-nas-common1:amd64 (6.1.0+opx2, 6.1.0+opx3), opx-platform-config-dell-vm:amd64 (1.4.1, 1.4.2), opx-nas-interface:amd64 (5.10.1+opx8, 5.10.1+opx11), opx-core:amd64 (2.2.1, 2.3.0), libopx-nas-acl1:amd64 (2.4.0+opx2, 2.4.0+opx3), opx-nas-common:amd64 (6.1.0+opx2, 6.1.0+opx3), opx-nas-linux:amd64 (5.11.0+opx3, 5.11.0+opx4), opx-dell-vm:amd64 (1.4.1, 1.4.2) End-Date: 2018-03-28 08:30:12 ``` * Reboot (`sudo reboot -f`), then SSH onto the box, and create a VLAN. I can no longer query it correctly: ``` opxUser@opx23_vm:~$ sudo cps_config_vlan.py --add --id 100 --vlantype 1 Success opxUser@opx23_vm:~$ sudo cps_get_oid.py \ > dell-base-if-cmn/if/interfaces/interface \ > if/interfaces/interface/type=ianaift:l2vlan ============dell-base-if-cmn/if/interfaces/interface========== dell-base-if-cmn/if/interfaces/interface/if-index = 6 if/interfaces/interface/type = base-if:cpu if/interfaces/interface/name = npu-0 ------------------------------------------------ . . . if/interfaces/interface/type = ianaift:ethernetCsmacd dell-if/if/interfaces/interface/tx-idle-time = 22272 dell-if/if/interfaces/interface/oui = 6976381 dell-if/if/interfaces/interface/tx-wake-time = 22272 dell-if/if/interfaces/interface/mode = 1 base-if-phy/if/interfaces/interface/port-id = 125 dell-if/if/interfaces-state/interface/supported-speed = 3,4,6 dell-if/if/interfaces/interface/mtu = 1532 base-if-phy/if/interfaces/interface/phy-media = 2 dell-if/if/interfaces/interface/fec = 2 base-if-phy/if/interfaces/interface/tagging-mode = 3 dell-if/if/interfaces/interface/eee = 0 ------------------------------------------------ dell-base-if-cmn/if/interfaces/interface/if-index = 39 dell-if/if/interfaces/interface/phys-address = 08:00:27:55:26:d5 if/interfaces/interface/type = ianaift:l2vlan base-if-vlan/if/interfaces/interface/id = 100 if/interfaces/interface/name = br100 dell-if/if/interfaces/interface/vlan-type = 1 dell-if/if/interfaces/interface/learning-mode = 1 dell-if/if/interfaces/interface/mtu = 1532 if/interfaces/interface/enabled = 0 ------------------------------------------------ ```
GarrickHe commented 6 years ago

@james-jra I believe I found the cause. It may have to do with another push that went in recently. Will keep you posted.

Thanks, Garrick

atanu-mandal commented 6 years ago

Hi James, Thanks for trying and providing us the detailed info. As Garrick has mentioned we are actively looking into this having found a probable cause. Will update you soon.

atanu-mandal commented 6 years ago

This is now fixed through https://review.openswitch.net/#/c/14697/

jeff-yin commented 6 years ago

Also https://review.openswitch.net/14696

The packages with the fixes are currently published to the "unstable" release stream and will be made available once the packages are promoted to "stable" in the next OPX bugfix release, 2.3.1.