Skip to content

Commit b36530d

Browse files
committed
tests: lldp: Add testcases for lldp/neighbor.
Signed-off-by: Changliang Wu <changliang.wu@smartx.com>
1 parent 2c80020 commit b36530d

File tree

3 files changed

+337
-0
lines changed

3 files changed

+337
-0
lines changed

tests/automake.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ TESTSUITE_AT = \
6868
tests/tunnel.at \
6969
tests/tunnel-push-pop.at \
7070
tests/tunnel-push-pop-ipv6.at \
71+
tests/ovs-lldp.at \
7172
tests/ovs-router.at \
7273
tests/lockfile.at \
7374
tests/reconnect.at \

tests/ovs-lldp.at

Lines changed: 335 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,335 @@
1+
AT_BANNER([ovs-lldp])
2+
3+
AT_SETUP([lldp - check lldp neighbor display])
4+
5+
OVS_VSWITCHD_START([])
6+
7+
AT_CHECK([
8+
ovs-vsctl set bridge br0 \
9+
datapath_type=dummy
10+
], [0])
11+
12+
AT_CHECK([
13+
ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy \
14+
lldp:enable=true
15+
], [0])
16+
17+
AT_CHECK([ovs-appctl netdev-dummy/receive p1 \
18+
'0180c200000ee878eecf78d588cc020704e878eecf78a80416054769676162697445746865726e6574312f302f3332060200790808746f5f37305f33310a0b424a59442d36372e3233370c1d48334320436f6d7761726520506c6174666f726d20536f6674776172650e0403140114100c0501c0a843ed020000027b00fe060080c2010bb8fe070080c202020000fe100080c203000109564c414e2030303031fe060080c2060000fe090080c2070100000000fe0900120f01036c01001efe0c00120f020101011000000000fe0600120f0428000000'])
19+
20+
AT_CHECK([ovs-appctl lldp/neighbor p1], [0], [dnl
21+
-------------------------------------------------------------------------------
22+
LLDP neighbor:
23+
-------------------------------------------------------------------------------
24+
Interface: p1
25+
Chassis:
26+
Chassis ID: e8:78:ee:cf:78:a8
27+
SysName: BJYD-67.237
28+
SysDescr: H3C Comware Platform Software
29+
MgmtIP: 192.168.67.237
30+
MgmtIface: 635
31+
Capability: Bridge, on
32+
Capability: Router, on
33+
Port:
34+
PortID: GigabitEthernet1/0/32
35+
PortDescr: to_70_31
36+
TTL: 121
37+
MFS: 10240
38+
PMD autoneg: supported: yes, enabled: yes
39+
Adv: 10Base-T, HD: yes, FD: yes
40+
Adv: 100Base-TX, HD: yes, FD: yes
41+
Adv: 1000Base-T, HD: no, FD: yes
42+
MAU oper type: 30
43+
MDI Power: supported: no, enabled: no, pair control: no
44+
Device type: PSE
45+
VLAN: 3000, pvid: no, VLAN 0001
46+
-------------------------------------------------------------------------------
47+
])
48+
49+
AT_CHECK([ovs-appctl --format json lldp/neighbor p1 | jq .lldp.interface[\[0\]].p1], [0], [dnl
50+
[{
51+
"chassis": {
52+
"BJYD-67.237": {
53+
"capability": [
54+
{
55+
"enabled": true,
56+
"type": "Bridge"
57+
},
58+
{
59+
"enabled": true,
60+
"type": "Router"
61+
}
62+
],
63+
"descr": "H3C Comware Platform Software",
64+
"id": {
65+
"type": "mac",
66+
"value": "e8:78:ee:cf:78:a8"
67+
},
68+
"mgmt-iface": [
69+
635
70+
],
71+
"mgmt-ip": [
72+
"192.168.67.237"
73+
]
74+
}
75+
},
76+
"port": {
77+
"auto-negotiation": {
78+
"advertised": [
79+
{
80+
"fd": true,
81+
"hd": true,
82+
"type": "10Base-T"
83+
},
84+
{
85+
"fd": true,
86+
"hd": true,
87+
"type": "100Base-TX"
88+
},
89+
{
90+
"fd": true,
91+
"hd": false,
92+
"type": "1000Base-T"
93+
}
94+
],
95+
"current": 30,
96+
"enabled": true,
97+
"supported": true
98+
},
99+
"desc": "to_70_31",
100+
"id": {
101+
"type": "ifname",
102+
"value": "GigabitEthernet1/0/32"
103+
},
104+
"mfs": 10240,
105+
"power": {
106+
"device-type": "PSE",
107+
"enabled": false,
108+
"paircontrol": false,
109+
"supported": false
110+
},
111+
"ttl": 121
112+
},
113+
"ppid": {
114+
"enabled": false,
115+
"supported": false
116+
},
117+
"vlan": {
118+
"pvid": false,
119+
"value": "VLAN 0001",
120+
"vlan-id": 3000
121+
}
122+
}]
123+
])
124+
125+
AT_CHECK([ovs-appctl netdev-dummy/receive p1 \
126+
'0180c200000e38a91c18a11c88cc02070438a91c18a10a0415054769676162697445746865726e6574312f302f3506020079081e4769676162697445746865726e6574312f302f3520496e746572666163650a0e37462d6a696572752d636875616e0c1d48334320436f6d7761726520506c6174666f726d20536f6674776172650e0403140114100c0501c0a843ea020000027b00fe060080c2010001fe070080c202020000fe100080c203000109564c414e2030303031fe060080c2060000fe090080c2070100000000fe0900120f01036c01001efe0c00120f0203010113000000fffe0600120f042800fe0900120f0301000000000000'])
127+
128+
AT_CHECK([ovs-appctl lldp/neighbor p1], [0], [dnl
129+
-------------------------------------------------------------------------------
130+
LLDP neighbor:
131+
-------------------------------------------------------------------------------
132+
Interface: p1
133+
Chassis:
134+
Chassis ID: e8:78:ee:cf:78:a8
135+
SysName: BJYD-67.237
136+
SysDescr: H3C Comware Platform Software
137+
MgmtIP: 192.168.67.237
138+
MgmtIface: 635
139+
Capability: Bridge, on
140+
Capability: Router, on
141+
Port:
142+
PortID: GigabitEthernet1/0/32
143+
PortDescr: to_70_31
144+
TTL: 121
145+
MFS: 10240
146+
PMD autoneg: supported: yes, enabled: yes
147+
Adv: 10Base-T, HD: yes, FD: yes
148+
Adv: 100Base-TX, HD: yes, FD: yes
149+
Adv: 1000Base-T, HD: no, FD: yes
150+
MAU oper type: 30
151+
MDI Power: supported: no, enabled: no, pair control: no
152+
Device type: PSE
153+
VLAN: 3000, pvid: no, VLAN 0001
154+
-------------------------------------------------------------------------------
155+
Interface: p1
156+
Chassis:
157+
Chassis ID: 38:a9:1c:18:a1:0a
158+
SysName: 7F-jieru-chuan
159+
SysDescr: H3C Comware Platform Software
160+
MgmtIP: 192.168.67.234
161+
MgmtIface: 635
162+
Capability: Bridge, on
163+
Capability: Router, on
164+
Port:
165+
PortID: GigabitEthernet1/0/5
166+
PortDescr: GigabitEthernet1/0/5 Interface
167+
TTL: 121
168+
MFS: 10240
169+
PMD autoneg: supported: yes, enabled: yes
170+
Adv: 10Base-T, HD: yes, FD: yes
171+
Adv: 100Base-TX, HD: yes, FD: yes
172+
Adv: 1000Base-T, HD: no, FD: yes
173+
MAU oper type: 30
174+
MDI Power: supported: yes, enabled: no, pair control: no
175+
Device type: PSE
176+
VLAN: 1, pvid: yes, VLAN 0001
177+
-------------------------------------------------------------------------------
178+
])
179+
180+
AT_CHECK([ovs-appctl --format json lldp/neighbor p1 | jq .lldp.interface ], [0], [dnl
181+
[[
182+
{
183+
"p1": {
184+
"chassis": {
185+
"BJYD-67.237": {
186+
"capability": [
187+
{
188+
"enabled": true,
189+
"type": "Bridge"
190+
},
191+
{
192+
"enabled": true,
193+
"type": "Router"
194+
}
195+
],
196+
"descr": "H3C Comware Platform Software",
197+
"id": {
198+
"type": "mac",
199+
"value": "e8:78:ee:cf:78:a8"
200+
},
201+
"mgmt-iface": [
202+
635
203+
],
204+
"mgmt-ip": [
205+
"192.168.67.237"
206+
]
207+
}
208+
},
209+
"port": {
210+
"auto-negotiation": {
211+
"advertised": [
212+
{
213+
"fd": true,
214+
"hd": true,
215+
"type": "10Base-T"
216+
},
217+
{
218+
"fd": true,
219+
"hd": true,
220+
"type": "100Base-TX"
221+
},
222+
{
223+
"fd": true,
224+
"hd": false,
225+
"type": "1000Base-T"
226+
}
227+
],
228+
"current": 30,
229+
"enabled": true,
230+
"supported": true
231+
},
232+
"desc": "to_70_31",
233+
"id": {
234+
"type": "ifname",
235+
"value": "GigabitEthernet1/0/32"
236+
},
237+
"mfs": 10240,
238+
"power": {
239+
"device-type": "PSE",
240+
"enabled": false,
241+
"paircontrol": false,
242+
"supported": false
243+
},
244+
"ttl": 121
245+
},
246+
"ppid": {
247+
"enabled": false,
248+
"supported": false
249+
},
250+
"vlan": {
251+
"pvid": false,
252+
"value": "VLAN 0001",
253+
"vlan-id": 3000
254+
}
255+
}
256+
},
257+
{
258+
"p1": {
259+
"chassis": {
260+
"7F-jieru-chuan": {
261+
"capability": [
262+
{
263+
"enabled": true,
264+
"type": "Bridge"
265+
},
266+
{
267+
"enabled": true,
268+
"type": "Router"
269+
}
270+
],
271+
"descr": "H3C Comware Platform Software",
272+
"id": {
273+
"type": "mac",
274+
"value": "38:a9:1c:18:a1:0a"
275+
},
276+
"mgmt-iface": [
277+
635
278+
],
279+
"mgmt-ip": [
280+
"192.168.67.234"
281+
]
282+
}
283+
},
284+
"port": {
285+
"auto-negotiation": {
286+
"advertised": [
287+
{
288+
"fd": true,
289+
"hd": true,
290+
"type": "10Base-T"
291+
},
292+
{
293+
"fd": true,
294+
"hd": true,
295+
"type": "100Base-TX"
296+
},
297+
{
298+
"fd": true,
299+
"hd": false,
300+
"type": "1000Base-T"
301+
}
302+
],
303+
"current": 30,
304+
"enabled": true,
305+
"supported": true
306+
},
307+
"desc": "GigabitEthernet1/0/5 Interface",
308+
"id": {
309+
"type": "ifname",
310+
"value": "GigabitEthernet1/0/5"
311+
},
312+
"mfs": 10240,
313+
"power": {
314+
"device-type": "PSE",
315+
"enabled": false,
316+
"paircontrol": false,
317+
"supported": true
318+
},
319+
"ttl": 121
320+
},
321+
"ppid": {
322+
"enabled": false,
323+
"supported": false
324+
},
325+
"vlan": {
326+
"pvid": true,
327+
"value": "VLAN 0001",
328+
"vlan-id": 1
329+
}
330+
}
331+
}
332+
]]
333+
])
334+
335+
AT_CLEANUP

tests/testsuite.at

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ m4_include([tests/ofproto-dpif.at])
6666
m4_include([tests/bridge.at])
6767
m4_include([tests/netdev-type.at])
6868
m4_include([tests/ovsdb.at])
69+
m4_include([tests/ovs-lldp.at])
6970
m4_include([tests/ovs-vsctl.at])
7071
m4_include([tests/stp.at])
7172
m4_include([tests/rstp.at])

0 commit comments

Comments
 (0)