@ -22,7 +22,6 @@ class TestCnosBgpModule(TestCnosModule):
def tearDown ( self ) :
def tearDown ( self ) :
super ( TestCnosBgpModule , self ) . tearDown ( )
super ( TestCnosBgpModule , self ) . tearDown ( )
self . mock_run_cnos_commands . stop ( )
self . mock_run_cnos_commands . stop ( )
os . remove ( ' test.log ' )
def load_fixtures ( self , commands = None , transport = ' cli ' ) :
def load_fixtures ( self , commands = None , transport = ' cli ' ) :
self . run_cnos_commands . return_value = [ load_fixture ( ' cnos_bgp_config.cfg ' ) ]
self . run_cnos_commands . return_value = [ load_fixture ( ' cnos_bgp_config.cfg ' ) ]
@ -30,7 +29,7 @@ class TestCnosBgpModule(TestCnosModule):
def test_bgp_neighbor ( self ) :
def test_bgp_neighbor ( self ) :
set_module_args ( { ' username ' : ' admin ' , ' password ' : ' pass ' ,
set_module_args ( { ' username ' : ' admin ' , ' password ' : ' pass ' ,
' host ' : ' 10.241.107.39 ' , ' deviceType ' : ' g8272_cnos ' ,
' host ' : ' 10.241.107.39 ' , ' deviceType ' : ' g8272_cnos ' ,
' outputfile ' : ' test.log ' , ' asNum ' : ' 33 ' ,
' outputfile ' : self . test_log , ' asNum ' : ' 33 ' ,
' bgpArg1 ' : ' neighbor ' , ' bgpArg2 ' : ' 10.241.107.40 ' ,
' bgpArg1 ' : ' neighbor ' , ' bgpArg2 ' : ' 10.241.107.40 ' ,
' bgpArg3 ' : ' 13 ' , ' bgpArg4 ' : ' address-family ' ,
' bgpArg3 ' : ' 13 ' , ' bgpArg4 ' : ' address-family ' ,
' bgpArg5 ' : ' ipv4 ' , ' bgpArg6 ' : ' next-hop-self ' } )
' bgpArg5 ' : ' ipv4 ' , ' bgpArg6 ' : ' next-hop-self ' } )
@ -41,7 +40,7 @@ class TestCnosBgpModule(TestCnosModule):
def test_cnos_bgp_dampening ( self ) :
def test_cnos_bgp_dampening ( self ) :
set_module_args ( { ' username ' : ' admin ' , ' password ' : ' pass ' ,
set_module_args ( { ' username ' : ' admin ' , ' password ' : ' pass ' ,
' host ' : ' 10.241.107.39 ' , ' deviceType ' : ' g8272_cnos ' ,
' host ' : ' 10.241.107.39 ' , ' deviceType ' : ' g8272_cnos ' ,
' outputfile ' : ' test.log ' , ' asNum ' : ' 33 ' ,
' outputfile ' : self . test_log , ' asNum ' : ' 33 ' ,
' bgpArg1 ' : ' address-family ' , ' bgpArg2 ' : ' ipv4 ' ,
' bgpArg1 ' : ' address-family ' , ' bgpArg2 ' : ' ipv4 ' ,
' bgpArg3 ' : ' dampening ' , ' bgpArg4 ' : ' 13 ' ,
' bgpArg3 ' : ' dampening ' , ' bgpArg4 ' : ' 13 ' ,
' bgpArg5 ' : ' 233 ' , ' bgpArg6 ' : ' 333 ' ,
' bgpArg5 ' : ' 233 ' , ' bgpArg6 ' : ' 333 ' ,
@ -53,7 +52,7 @@ class TestCnosBgpModule(TestCnosModule):
def test_cnos_bgp_network ( self ) :
def test_cnos_bgp_network ( self ) :
set_module_args ( { ' username ' : ' admin ' , ' password ' : ' pass ' ,
set_module_args ( { ' username ' : ' admin ' , ' password ' : ' pass ' ,
' host ' : ' 10.241.107.39 ' , ' deviceType ' : ' g8272_cnos ' ,
' host ' : ' 10.241.107.39 ' , ' deviceType ' : ' g8272_cnos ' ,
' outputfile ' : ' test.log ' , ' asNum ' : ' 33 ' ,
' outputfile ' : self . test_log , ' asNum ' : ' 33 ' ,
' bgpArg1 ' : ' address-family ' , ' bgpArg2 ' : ' ipv4 ' ,
' bgpArg1 ' : ' address-family ' , ' bgpArg2 ' : ' ipv4 ' ,
' bgpArg3 ' : ' network ' , ' bgpArg4 ' : ' 1.2.3.4/5 ' ,
' bgpArg3 ' : ' network ' , ' bgpArg4 ' : ' 1.2.3.4/5 ' ,
' bgpArg5 ' : ' backdoor ' } )
' bgpArg5 ' : ' backdoor ' } )
@ -64,7 +63,7 @@ class TestCnosBgpModule(TestCnosModule):
def test_cnos_bgp_clusterid ( self ) :
def test_cnos_bgp_clusterid ( self ) :
set_module_args ( { ' username ' : ' admin ' , ' password ' : ' pass ' ,
set_module_args ( { ' username ' : ' admin ' , ' password ' : ' pass ' ,
' host ' : ' 10.241.107.39 ' , ' deviceType ' : ' g8272_cnos ' ,
' host ' : ' 10.241.107.39 ' , ' deviceType ' : ' g8272_cnos ' ,
' outputfile ' : ' test.log ' , ' asNum ' : ' 33 ' ,
' outputfile ' : self . test_log , ' asNum ' : ' 33 ' ,
' bgpArg1 ' : ' cluster-id ' , ' bgpArg2 ' : ' 10.241.107.40 ' } )
' bgpArg1 ' : ' cluster-id ' , ' bgpArg2 ' : ' 10.241.107.40 ' } )
result = self . execute_module ( changed = True )
result = self . execute_module ( changed = True )
expected_result = ' BGP configurations accomplished '
expected_result = ' BGP configurations accomplished '
@ -73,7 +72,7 @@ class TestCnosBgpModule(TestCnosModule):
def test_cnos_bgp_graceful_restart ( self ) :
def test_cnos_bgp_graceful_restart ( self ) :
set_module_args ( { ' username ' : ' admin ' , ' password ' : ' pass ' ,
set_module_args ( { ' username ' : ' admin ' , ' password ' : ' pass ' ,
' host ' : ' 10.241.107.39 ' , ' deviceType ' : ' g8272_cnos ' ,
' host ' : ' 10.241.107.39 ' , ' deviceType ' : ' g8272_cnos ' ,
' outputfile ' : ' test.log ' , ' asNum ' : ' 33 ' ,
' outputfile ' : self . test_log , ' asNum ' : ' 33 ' ,
' bgpArg1 ' : ' graceful-restart ' , ' bgpArg2 ' : ' 333 ' } )
' bgpArg1 ' : ' graceful-restart ' , ' bgpArg2 ' : ' 333 ' } )
result = self . execute_module ( changed = True )
result = self . execute_module ( changed = True )
expected_result = ' BGP configurations accomplished '
expected_result = ' BGP configurations accomplished '
@ -82,7 +81,7 @@ class TestCnosBgpModule(TestCnosModule):
def test_cnos_bgp_routerid ( self ) :
def test_cnos_bgp_routerid ( self ) :
set_module_args ( { ' username ' : ' admin ' , ' password ' : ' pass ' ,
set_module_args ( { ' username ' : ' admin ' , ' password ' : ' pass ' ,
' host ' : ' 10.241.107.39 ' , ' deviceType ' : ' g8272_cnos ' ,
' host ' : ' 10.241.107.39 ' , ' deviceType ' : ' g8272_cnos ' ,
' outputfile ' : ' test.log ' , ' asNum ' : ' 33 ' ,
' outputfile ' : self . test_log , ' asNum ' : ' 33 ' ,
' bgpArg1 ' : ' router-id ' , ' bgpArg2 ' : ' 1.2.3.4 ' } )
' bgpArg1 ' : ' router-id ' , ' bgpArg2 ' : ' 1.2.3.4 ' } )
result = self . execute_module ( changed = True )
result = self . execute_module ( changed = True )
expected_result = ' BGP configurations accomplished '
expected_result = ' BGP configurations accomplished '
@ -91,7 +90,7 @@ class TestCnosBgpModule(TestCnosModule):
def test_cnos_bgp_vrf ( self ) :
def test_cnos_bgp_vrf ( self ) :
set_module_args ( { ' username ' : ' admin ' , ' password ' : ' pass ' ,
set_module_args ( { ' username ' : ' admin ' , ' password ' : ' pass ' ,
' host ' : ' 10.241.107.39 ' , ' deviceType ' : ' g8272_cnos ' ,
' host ' : ' 10.241.107.39 ' , ' deviceType ' : ' g8272_cnos ' ,
' outputfile ' : ' test.log ' , ' asNum ' : ' 33 ' ,
' outputfile ' : self . test_log , ' asNum ' : ' 33 ' ,
' bgpArg1 ' : ' vrf ' } )
' bgpArg1 ' : ' vrf ' } )
result = self . execute_module ( changed = True )
result = self . execute_module ( changed = True )
expected_result = ' BGP configurations accomplished '
expected_result = ' BGP configurations accomplished '