@@ -845,6 +845,61 @@ def test_interfaces():
845845 ' gateway 2001:db8:dead:beef::1\n ' ,
846846 ' accept_ra 2\n ' ,
847847 '\n ' ]},
848+
849+ # Command hooks
850+ {'iface_name' : 'eth_optmap_test' , 'iface_type' : 'eth' , 'enabled' : True ,
851+ 'build_interface' : {
852+ 'proto' : 'manual' ,
853+ 'up_cmds' : ['echo "interface up"' ],
854+ 'down_cmds' : ['echo "interface down"' ],
855+ 'pre_up_cmds' : ['echo "pre-up"' ],
856+ 'post_up_cmds' : ['echo "post-up"' ],
857+ 'pre_down_cmds' : ['echo "pre-down"' ],
858+ 'post_down_cmds' : ['echo "post-down"' ],
859+ },
860+ 'get_interface' : odict ([('eth_optmap_test' , odict ([('enabled' , True ), ('data' , odict ([
861+ ('inet' , odict ([
862+ ('addrfam' , 'inet' ),
863+ ('proto' , 'manual' ),
864+ ('filename' , None ),
865+ ('up_cmds' , ['echo "interface up"' ]),
866+ ('down_cmds' , ['echo "interface down"' ]),
867+ ('pre_up_cmds' , ['echo "pre-up"' ]),
868+ ('post_up_cmds' , ['echo "post-up"' ]),
869+ ('pre_down_cmds' , ['echo "pre-down"' ]),
870+ ('post_down_cmds' , ['echo "post-down"' ]),
871+ ])),
872+ ]))]))]),
873+ 'return' : [
874+ 'auto eth_optmap_test\n ' ,
875+ 'iface eth_optmap_test inet manual\n ' ,
876+ ' up echo "interface up"\n ' ,
877+ ' down echo "interface down"\n ' ,
878+ ' pre-up echo "pre-up"\n ' ,
879+ ' post-up echo "post-up"\n ' ,
880+ ' pre-down echo "pre-down"\n ' ,
881+ ' post-down echo "post-down"\n ' ,
882+ '\n ' ]},
883+
884+ # hwaddr should map to hwaddress
885+ {'iface_name' : 'eth_hwaddr_test' , 'iface_type' : 'eth' , 'enabled' : True ,
886+ 'build_interface' : {
887+ 'proto' : 'manual' ,
888+ 'hwaddr' : '00:11:22:33:44:55' ,
889+ },
890+ 'get_interface' : odict ([('eth_hwaddr_test' , odict ([('enabled' , True ), ('data' , odict ([
891+ ('inet' , odict ([
892+ ('addrfam' , 'inet' ),
893+ ('proto' , 'manual' ),
894+ ('filename' , None ),
895+ ('hwaddress' , '00:11:22:33:44:55' ),
896+ ])),
897+ ]))]))]),
898+ 'return' : [
899+ 'auto eth_hwaddr_test\n ' ,
900+ 'iface eth_hwaddr_test inet manual\n ' ,
901+ ' hwaddress 00:11:22:33:44:55\n ' ,
902+ '\n ' ]},
848903 ]
849904# fmt: on
850905
0 commit comments