Skip to content

Commit 96079bf

Browse files
committed
Change test and fix spelling mistake
Signed-off-by: d-dashkov <[email protected]>
1 parent 8117378 commit 96079bf

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

config/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,7 @@ def cli_sroute_to_config(ctx, command_str, strict_nh = True):
896896
if nh.startswith('PortChannel'):
897897
config_db = ctx.obj['config_db']
898898
if not nh in config_db.get_keys('PORTCHANNEL'):
899-
ctx.fail("portchannel doest not exist.")
899+
ctx.fail("portchannel does not exist.")
900900
else:
901901
ipaddress.ip_address(nh)
902902
except ValueError:

tests/static_routes_test.py

+5-17
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
ERROR_INVALID_IP = '''
2626
Error: ip address is not valid.
2727
'''
28+
ERROR_INVALID_PORTCHANNEL = '''
29+
Error: portchannel doest not exist.
30+
'''
2831

2932

3033
class TestStaticRoutes(object):
@@ -51,31 +54,16 @@ def test_simple_static_route(self):
5154
print(result.exit_code, result.output)
5255
assert not '1.2.3.4/32' in db.cfgdb.get_table('STATIC_ROUTE')
5356

54-
def test_portchannel_static_route(self):
57+
def test_invalid_portchannel_static_route(self):
5558
db = Db()
5659
runner = CliRunner()
5760
obj = {'config_db':db.cfgdb}
5861

59-
# config portchannel add PortChannel0101
60-
result = runner.invoke(config.config.commands["portchannel"].commands["add"], ["PortChannel0101"], obj=obj)
61-
print(result.exit_code, result.output)
62-
6362
# config route add prefix 1.2.3.4/32 nexthop PortChannel0101
6463
result = runner.invoke(config.config.commands["route"].commands["add"], \
6564
["prefix", "1.2.3.4/32", "nexthop", "PortChannel0101"], obj=obj)
6665
print(result.exit_code, result.output)
67-
assert ('1.2.3.4/32') in db.cfgdb.get_table('STATIC_ROUTE')
68-
assert db.cfgdb.get_entry('STATIC_ROUTE', '1.2.3.4/32') == {'nexthop': 'PortChannel0101', 'blackhole': 'false', 'distance': '0', 'ifname': '', 'nexthop-vrf': ''}
69-
70-
# config route del prefix 1.2.3.4/32 nexthop PortChannel0101
71-
result = runner.invoke(config.config.commands["route"].commands["del"], \
72-
["prefix", "1.2.3.4/32", "nexthop", "PortChannel0101"], obj=obj)
73-
print(result.exit_code, result.output)
74-
assert not '1.2.3.4/32' in db.cfgdb.get_table('STATIC_ROUTE')
75-
76-
# config portchannel del PortChannel0101
77-
result = runner.invoke(config.config.commands["portchannel"].commands["del"], ["PortChannel0101"], obj=obj)
78-
print(result.exit_code, result.output)
66+
assert ERROR_INVALID_PORTCHANNEL in result.output
7967

8068
def test_static_route_invalid_prefix_ip(self):
8169
db = Db()

0 commit comments

Comments
 (0)