summaryrefslogtreecommitdiff
path: root/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_close.py
blob: 9fdef84cdfa2c2015c778a2162f1c31f77fac2cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
from lutil import luCommand

holddownFactorSet = luCommand(
    "r1",
    'vtysh -c "show running"',
    "rfp holddown-factor",
    "none",
    "Holddown factor set",
)
if not holddownFactorSet:
    to = "-1"
else:
    to = "1"
luCommand(
    "r1",
    'vtysh -c "debug rfapi-dev open vn 20.0.0.1 un 1.1.1.21"',
    "rfapi_set_response_cb: status 0",
    "pass",
    "Opened RFAPI",
)
luCommand(
    "r1",
    'vtysh -c "debug rfapi-dev register vn 20.0.0.1 un 1.1.1.21 prefix 111.111.111.0/24 lifetime {}"'.format(
        to
    ),
    "",
    "none",
    "Prefix registered",
)
luCommand(
    "r1",
    'vtysh -c "show vnc registrations local"',
    "111.111.111.0/24",
    "wait",
    "Local registration",
    1,
)
luCommand("r1", 'vtysh -c "show vnc registrations"', ".", "none")
luCommand(
    "r3",
    'vtysh -c "show vnc registrations"',
    "111.111.111.0/24",
    "wait",
    "See registration",
)
luCommand(
    "r4",
    'vtysh -c "show vnc registrations"',
    "111.111.111.0/24",
    "wait",
    "See registration",
)
luCommand(
    "r1",
    'vtysh -c "debug rfapi-dev close vn 20.0.0.1 un 1.1.1.21"',
    "status 0",
    "pass",
    "Closed RFAPI",
)
luCommand(
    "r1",
    'vtysh -c "show vnc registrations"',
    "Locally: *Active:  1 .* Remotely: *Active:  3",
    "wait",
    "See cleanup",
)
luCommand(
    "r3",
    'vtysh -c "show vnc registrations"',
    "Locally: *Active:  1 .* Remotely: *Active:  3",
    "wait",
    "See cleanup",
)
luCommand(
    "r4",
    'vtysh -c "show vnc registrations"',
    "Locally: *Active:  2 .* Remotely: *Active:  2",
    "wait",
    "See cleanup",
)
luCommand(
    "r1",
    'vtysh -c "show vnc registrations"',
    "In Holddown: *Active:  0",
    "wait",
    "Out of holddown",
    20,
)
luCommand(
    "r3",
    'vtysh -c "show vnc registrations"',
    "In Holddown: *Active:  0",
    "wait",
    "Out of holddown",
)
luCommand(
    "r4",
    'vtysh -c "show vnc registrations"',
    "In Holddown: *Active:  0",
    "wait",
    "Out of holddown",
)