Changliang Wu <changliang...@smartx.com> writes:

> Signed-off-by: Changliang Wu <changliang...@smartx.com>
> ---
>  tests/automake.mk  |   1 +
>  tests/ovs-lldp.at  | 232 +++++++++++++++++++++++++++++++++++++++++++++
>  tests/testsuite.at |   1 +
>  3 files changed, 234 insertions(+)
>  create mode 100644 tests/ovs-lldp.at
>
> diff --git a/tests/automake.mk b/tests/automake.mk
> index 59f538761..a453a0c4b 100644
> --- a/tests/automake.mk
> +++ b/tests/automake.mk
> @@ -68,6 +68,7 @@ TESTSUITE_AT = \
>       tests/tunnel.at \
>       tests/tunnel-push-pop.at \
>       tests/tunnel-push-pop-ipv6.at \
> +     tests/ovs-lldp.at \
>       tests/ovs-router.at \
>       tests/lockfile.at \
>       tests/reconnect.at \
> diff --git a/tests/ovs-lldp.at b/tests/ovs-lldp.at
> new file mode 100644
> index 000000000..d0796ef37
> --- /dev/null
> +++ b/tests/ovs-lldp.at
> @@ -0,0 +1,232 @@
> +AT_BANNER([ovs-lldp])
> +
> +AT_SETUP([lldp - check lldp neighbor display])
> +
> +OVS_VSWITCHD_START([])
> +
> +AT_CHECK([
> +    ovs-vsctl set bridge br0 \
> +    datapath_type=dummy
> +], [0])

Is this needed?  I think the OVS_VSWITCHD_START should create the bridge
with dummy DP:

# OVS_VSWITCHD_START([vsctl-args], [vsctl-output], [=override],
#                    [vswitchd-aux-args])
#
# Creates a database and starts ovsdb-server, starts ovs-vswitchd
# connected to that database, calls ovs-vsctl to create a bridge named
# br0 with predictable settings, passing 'vsctl-args' as additional
# commands to ovs-vsctl.  If 'vsctl-args' causes ovs-vsctl to provide
# output (e.g. because it includes "create" commands) then 'vsctl-output'
# specifies the expected output after filtering through uuidfilt.

> +
> +AT_CHECK([
> +    ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy \
> +    lldp:enable=true
> +], [0])

I would suggest something like::

  add_of_ports br0 1
  AT_CHECK([ovs-vsctl set Interface p1 lldp:enable=true])

> +
> +AT_CHECK([ovs-appctl netdev-dummy/receive p1 \
> +'0180c200000e38a91c18a12688cc020704aaaaaaaaaaaa0416054769676162697445746865726e6574312f302f313506020079081f4769676162697445746865726e6574312f302f313520496e746572666163650a0e46616b6553797374656d4e616d650c0e46616b6553797374656d446573630e0403140114100c0501c0a80001020000027b00fe060080c2010001fe070080c202020000fe100080c203000109564c414e2030303031fe060080c2060000fe090080c2070100000000fe0900120f01036c01001efe0c00120f0203010113000000fffe0600120f042800fe0900120f0301000000000000'])
> +
> +AT_CHECK([ovs-appctl lldp/neighbor p1], [0], [dnl
> +LLDP neighbor:
> +Interface: p1
> +  Chassis:
> +    Chassis ID:         aa:aa:aa:aa:aa:aa
> +    SysName:            FakeSystemName
> +    SysDescr:           FakeSystemDesc
> +    MgmtIP:             192.168.0.1
> +    MgmtIface:          635
> +    Capability:         Bridge, on
> +    Capability:         Router, on
> +  Port:
> +    PortID:             GigabitEthernet1/0/15
> +    PortDescr:          GigabitEthernet1/0/15 Interface
> +    TTL:                121
> +    MFS:                10240
> +    PMD autoneg: supported: yes, enabled: yes
> +      Adv:              10Base-T, HD: yes, FD: yes
> +      Adv:              100Base-TX, HD: yes, FD: yes
> +      Adv:              1000Base-T, HD: no, FD: yes
> +      MAU oper type:    30
> +    MDI Power: supported: yes, enabled: no, pair control: no
> +  VLAN:               1, pvid: yes, VLAN 0001
> +  PPVID:              supported: yes,enabled no
> +])
> +
> +AT_CHECK([ovs-appctl --format json --pretty lldp/neighbor p1 ], [0], [dnl
> +[{
> +  "lldp": {
> +    "interface": {
> +      "p1": {
> +        "chassis": {
> +          "FakeSystemName": {
> +            "capability": [
> +              {
> +                "enabled": true,
> +                "type": "Bridge"},
> +              {
> +                "enabled": true,
> +                "type": "Router"}],
> +            "descr": "FakeSystemDesc",
> +            "id": {
> +              "type": "mac",
> +              "value": "aa:aa:aa:aa:aa:aa"},
> +            "mgmt-iface": [
> +              635],
> +            "mgmt-ip": [
> +              "192.168.0.1"]}},
> +        "port": {
> +          "auto-negotiation": {
> +            "current": 30,
> +            "enabled": true,
> +            "supported": true},
> +          "desc": "GigabitEthernet1/0/15 Interface",
> +          "id": {
> +            "type": "ifname",
> +            "value": "GigabitEthernet1/0/15"},
> +          "mfs": 10240,
> +          "power": {
> +            "enabled": false,
> +            "paircontrol": false,
> +            "supported": true},
> +          "ttl": 121},
> +        "ppvid": {
> +          "enabled": false,
> +          "supported": true},
> +        "vlan": {
> +          "pvid": true,
> +          "value": "VLAN 0001",
> +          "vlan-id": 1}}}}}]
> +])
> +
> +AT_CHECK([ovs-appctl netdev-dummy/receive p1 \
> +'0180c200000e38a91c18a11c88cc020704aaaaaaaaaaaa0415054769676162697445746865726e6574312f302f3506020079081e4769676162697445746865726e6574312f302f3520496e746572666163650a0e46616b6553797374656d4e616d650c0e46616b6553797374656d446573630e0403140114100c0501c0a80001020000027b00fe060080c2010001fe070080c202020000fe100080c203000109564c414e2030303031fe060080c2060000fe090080c2070100000000fe0900120f01036c01001efe0c00120f0203010113000000fffe0600120f042800fe0900120f0301000000000000'])
> +
> +AT_CHECK([ovs-appctl lldp/neighbor p1], [0], [dnl
> +LLDP neighbor:
> +Interface: p1
> +  Chassis:
> +    Chassis ID:         aa:aa:aa:aa:aa:aa
> +    SysName:            FakeSystemName
> +    SysDescr:           FakeSystemDesc
> +    MgmtIP:             192.168.0.1
> +    MgmtIface:          635
> +    Capability:         Bridge, on
> +    Capability:         Router, on
> +  Port:
> +    PortID:             GigabitEthernet1/0/15
> +    PortDescr:          GigabitEthernet1/0/15 Interface
> +    TTL:                121
> +    MFS:                10240
> +    PMD autoneg: supported: yes, enabled: yes
> +      Adv:              10Base-T, HD: yes, FD: yes
> +      Adv:              100Base-TX, HD: yes, FD: yes
> +      Adv:              1000Base-T, HD: no, FD: yes
> +      MAU oper type:    30
> +    MDI Power: supported: yes, enabled: no, pair control: no
> +  VLAN:               1, pvid: yes, VLAN 0001
> +  PPVID:              supported: yes,enabled no
> +
> +Interface: p1
> +  Chassis:
> +    Chassis ID:         aa:aa:aa:aa:aa:aa
> +    SysName:            FakeSystemName
> +    SysDescr:           FakeSystemDesc
> +    MgmtIP:             192.168.0.1
> +    MgmtIface:          635
> +    Capability:         Bridge, on
> +    Capability:         Router, on
> +  Port:
> +    PortID:             GigabitEthernet1/0/5
> +    PortDescr:          GigabitEthernet1/0/5 Interface
> +    TTL:                121
> +    MFS:                10240
> +    PMD autoneg: supported: yes, enabled: yes
> +      Adv:              10Base-T, HD: yes, FD: yes
> +      Adv:              100Base-TX, HD: yes, FD: yes
> +      Adv:              1000Base-T, HD: no, FD: yes
> +      MAU oper type:    30
> +    MDI Power: supported: yes, enabled: no, pair control: no
> +  VLAN:               1, pvid: yes, VLAN 0001
> +  PPVID:              supported: yes,enabled no
> +])
> +
> +AT_CHECK([ovs-appctl --format json --pretty lldp/neighbor p1 ], [0], [dnl
> +[{
> +  "lldp": {
> +    "interface": [
> +      {
> +        "p1": {
> +          "chassis": {
> +            "FakeSystemName": {
> +              "capability": [
> +                {
> +                  "enabled": true,
> +                  "type": "Bridge"},
> +                {
> +                  "enabled": true,
> +                  "type": "Router"}],
> +              "descr": "FakeSystemDesc",
> +              "id": {
> +                "type": "mac",
> +                "value": "aa:aa:aa:aa:aa:aa"},
> +              "mgmt-iface": [
> +                635],
> +              "mgmt-ip": [
> +                "192.168.0.1"]}},
> +          "port": {
> +            "auto-negotiation": {
> +              "current": 30,
> +              "enabled": true,
> +              "supported": true},
> +            "desc": "GigabitEthernet1/0/15 Interface",
> +            "id": {
> +              "type": "ifname",
> +              "value": "GigabitEthernet1/0/15"},
> +            "mfs": 10240,
> +            "power": {
> +              "enabled": false,
> +              "paircontrol": false,
> +              "supported": true},
> +            "ttl": 121},
> +          "ppvid": {
> +            "enabled": false,
> +            "supported": true},
> +          "vlan": {
> +            "pvid": true,
> +            "value": "VLAN 0001",
> +            "vlan-id": 1}}},
> +      {
> +        "p1": {
> +          "chassis": {
> +            "FakeSystemName": {
> +              "capability": [
> +                {
> +                  "enabled": true,
> +                  "type": "Bridge"},
> +                {
> +                  "enabled": true,
> +                  "type": "Router"}],
> +              "descr": "FakeSystemDesc",
> +              "id": {
> +                "type": "mac",
> +                "value": "aa:aa:aa:aa:aa:aa"},
> +              "mgmt-iface": [
> +                635],
> +              "mgmt-ip": [
> +                "192.168.0.1"]}},
> +          "port": {
> +            "auto-negotiation": {
> +              "current": 30,
> +              "enabled": true,
> +              "supported": true},
> +            "desc": "GigabitEthernet1/0/5 Interface",
> +            "id": {
> +              "type": "ifname",
> +              "value": "GigabitEthernet1/0/5"},
> +            "mfs": 10240,
> +            "power": {
> +              "enabled": false,
> +              "paircontrol": false,
> +              "supported": true},
> +            "ttl": 121},
> +          "ppvid": {
> +            "enabled": false,
> +            "supported": true},
> +          "vlan": {
> +            "pvid": true,
> +            "value": "VLAN 0001",
> +            "vlan-id": 1}}}]}}]
> +])
> +
> +AT_CLEANUP
> \ No newline at end of file
> diff --git a/tests/testsuite.at b/tests/testsuite.at
> index 9d77a9f51..f80656076 100644
> --- a/tests/testsuite.at
> +++ b/tests/testsuite.at
> @@ -66,6 +66,7 @@ m4_include([tests/ofproto-dpif.at])
>  m4_include([tests/bridge.at])
>  m4_include([tests/netdev-type.at])
>  m4_include([tests/ovsdb.at])
> +m4_include([tests/ovs-lldp.at])
>  m4_include([tests/ovs-vsctl.at])
>  m4_include([tests/stp.at])
>  m4_include([tests/rstp.at])

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to