File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from unittest import skip
2+
3+ from .mock import ConverterTest , RouteAirOs
4+
5+
6+ class TestRouteConverter (ConverterTest ):
7+
8+ backend = RouteAirOs
9+
10+ def test_gateway_interface (self ):
11+ o = self .backend ({
12+ 'interfaces' : [{
13+ 'name' : 'eth0' ,
14+ 'type' : 'ethernet' ,
15+ 'addresses' : [
16+ {
17+ 'family' : 'ipv4' ,
18+ 'proto' : 'dhcp' ,
19+ 'gateway' : '192.168.0.1'
20+ }
21+ ]
22+ }]
23+ })
24+
25+ o .to_intermediate ()
26+
27+ expected = [
28+ {
29+ '1.devname' : 'eth0' ,
30+ '1.gateway' : '192.168.0.1' ,
31+ '1.ip' : '0.0.0.0' ,
32+ '1.netmask' : 0 ,
33+ '1.status' : 'enabled' ,
34+ },
35+ ]
36+
37+ self .assertEqualConfig (o .intermediate_data ['route' ], expected )
38+
39+ def test_user_route (self ):
40+ o = self .backend ({
41+ 'routes' : [
42+ {
43+ 'cost' : 0 ,
44+ 'destination' : '192.178.1.0/24' ,
45+ 'device' : 'br0' ,
46+ 'next' : '192.178.1.1' ,
47+ 'source' : '192.168.1.20' ,
48+ }
49+ ]
50+ })
51+ o .to_intermediate ()
52+ expected = [
53+ {
54+ '1.ip' : '192.178.1.0' ,
55+ '1.netmask' : '255.255.255.0' ,
56+ '1.gateway' : '192.178.1.1' ,
57+ '1.status' : 'enabled' ,
58+ },
59+ {
60+ 'status' : 'enabled' ,
61+ },
62+ ]
63+
64+ self .assertEqualConfig (o .intermediate_data ['route' ], expected )
You can’t perform that action at this time.
0 commit comments