Skip to content

Commit c170a8a

Browse files
author
Ritwick DSouza
committed
[raspbian] Added tests for static routes
1 parent ee7eb5d commit c170a8a

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

tests/raspbian/test_routes.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,72 @@ def test_ipv4_static_route(self):
6969
post-up route add -net 192.168.4.1 netmask 255.255.255.0 gw 192.168.2.2
7070
pre-up route del -net 192.168.4.1 netmask 255.255.255.0 gw 192.168.2.2
7171
72+
'''
73+
self.assertEqual(o.render(), expected)
74+
75+
def test_ipv6_manual_route(self):
76+
o = Raspbian({
77+
"interfaces": [
78+
{
79+
"name": "eth0",
80+
"type": "ethernet"
81+
}
82+
],
83+
"routes": [
84+
{
85+
"device": "eth0",
86+
"destination": "fd89::1/128",
87+
"next": "fd88::1",
88+
"cost": 0,
89+
}
90+
]
91+
})
92+
93+
expected = '''# config: /etc/network/interfaces
94+
95+
auto eth0
96+
iface eth0 inet manual
97+
up ip -6 route add fd89::1/128 via fd88::1 dev eth0
98+
down ip -6 route del fd89::1/128 via fd88::1 dev eth0
99+
100+
'''
101+
102+
self.assertEqual(o.render(), expected)
103+
104+
def test_ipv6_static_route(self):
105+
o = Raspbian({
106+
"interfaces": [
107+
{
108+
"name": "eth0",
109+
"type": "ethernet",
110+
"addresses": [
111+
{
112+
"family": "ipv6",
113+
"proto": "static",
114+
"address": "fe80::ba27:ebff:fe1c:5477",
115+
"mask": 64
116+
}
117+
]
118+
}
119+
],
120+
"routes": [
121+
{
122+
"device": "eth0",
123+
"destination": "fd89::1/128",
124+
"next": "fd88::1",
125+
"cost": 0,
126+
}
127+
]
128+
})
129+
130+
expected = '''# config: /etc/network/interfaces
131+
132+
auto eth0
133+
iface eth0 inet6 static
134+
address fe80::ba27:ebff:fe1c:5477
135+
netmask 64
136+
up ip -6 route add fd89::1/128 via fd88::1 dev eth0
137+
down ip -6 route del fd89::1/128 via fd88::1 dev eth0
138+
72139
'''
73140
self.assertEqual(o.render(), expected)

0 commit comments

Comments
 (0)