From 7e08555013e8f74b9c71194461c031e70f4d2c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Thu, 7 Nov 2024 10:13:05 +0100 Subject: [PATCH] tests: Convert to put_config_dicts Convert from put_config_dict to put_config_dicts --- test/case/ietf_routing/static_routing/test.py | 211 +++++++++--------- test/case/ietf_system/timezone/test.py | 4 +- .../ietf_system/timezone_utc_offset/test.py | 4 +- 3 files changed, 111 insertions(+), 108 deletions(-) diff --git a/test/case/ietf_routing/static_routing/test.py b/test/case/ietf_routing/static_routing/test.py index 3b2d22ee..665f8705 100755 --- a/test/case/ietf_routing/static_routing/test.py +++ b/test/case/ietf_routing/static_routing/test.py @@ -27,96 +27,99 @@ from infamy.util import until, parallel def config_target1(target, data, link): - target.put_config_dict("ietf-interfaces", { - "interfaces": { - "interface": [ - { - "name": data, - "enabled": True, - "ipv4": { - "forwarding": True, - "address": [{ - "ip": "192.168.10.1", - "prefix-length": 24 - }]}, - "ipv6": { - "forwarding": True, - "address": [{ - "ip": "2001:db8:3c4d:10::1", - "prefix-length": 64 - }] - } - }, - { - "name": link, - "enabled": True, - "ipv4": { - "forwarding": True, - "address": [{ - "ip": "192.168.50.1", - "prefix-length": 24 - }] - }, - "ipv6": { - "forwarding": True, - "address": [{ - "ip": "2001:db8:3c4d:50::1", - "prefix-length": 64 - }] - } - }, - { - "name": "lo", - "enabled": True, - "ipv4": { - "address": [{ - "ip": "192.168.100.1", - "prefix-length": 32 - }] - }, - "ipv6": { - "address": [{ - "ip": "2001:db8:3c4d:100::1", - "prefix-length": 128 - }] - } - - } - ] - } - }) - target.put_config_dict("ietf-routing", { - "routing": { - "control-plane-protocols": { - "control-plane-protocol": [{ - "type": "infix-routing:static", - "name": "default", - "static-routes": { + target.put_config_dicts({ + "ietf-interfaces": { + "interfaces": { + "interface": [ + { + "name": data, + "enabled": True, "ipv4": { - "route": [{ - "destination-prefix": "192.168.200.1/32", - "next-hop": { - "next-hop-address": "192.168.50.2" - } + "forwarding": True, + "address": [{ + "ip": "192.168.10.1", + "prefix-length": 24 + }]}, + "ipv6": { + "forwarding": True, + "address": [{ + "ip": "2001:db8:3c4d:10::1", + "prefix-length": 64 + }] + } + }, + { + "name": link, + "enabled": True, + "ipv4": { + "forwarding": True, + "address": [{ + "ip": "192.168.50.1", + "prefix-length": 24 }] }, "ipv6": { - "route": [{ - "destination-prefix": "2001:db8:3c4d:200::1/128", - "next-hop": { - "next-hop-address": "2001:db8:3c4d:50::2" - } + "forwarding": True, + "address": [{ + "ip": "2001:db8:3c4d:50::1", + "prefix-length": 64 }] } - } - }] + }, + { + "name": "lo", + "enabled": True, + "ipv4": { + "address": [{ + "ip": "192.168.100.1", + "prefix-length": 32 + }] + }, + "ipv6": { + "address": [{ + "ip": "2001:db8:3c4d:100::1", + "prefix-length": 128 + }] + } + + } + ] + } + }, + "ietf-routing": { + "routing": { + "control-plane-protocols": { + "control-plane-protocol": [{ + "type": "infix-routing:static", + "name": "default", + "static-routes": { + "ipv4": { + "route": [{ + "destination-prefix": "192.168.200.1/32", + "next-hop": { + "next-hop-address": "192.168.50.2" + } + }] + }, + "ipv6": { + "route": [{ + "destination-prefix": "2001:db8:3c4d:200::1/128", + "next-hop": { + "next-hop-address": "2001:db8:3c4d:50::2" + } + }] + } + } + }] + } } } }) def config_target2(target, link): - target.put_config_dict("ietf-interfaces", { + target.put_config_dicts({ + "ietf-interfaces": { "interfaces": { "interface": [ { @@ -157,33 +160,33 @@ def config_target2(target, link): } ] } - }) - - target.put_config_dict("ietf-routing", { - "routing": { - "control-plane-protocols": { - "control-plane-protocol": [{ - "type": "infix-routing:static", - "name": "default", - "static-routes": { - "ipv4": { - "route": [{ - "destination-prefix": "0.0.0.0/0", - "next-hop": { - "next-hop-address": "192.168.50.1" - } - }] - }, - "ipv6": { - "route": [{ - "destination-prefix": "::/0", - "next-hop": { - "next-hop-address": "2001:db8:3c4d:50::1" - } - }] + }, + "ietf-routing": { + "routing": { + "control-plane-protocols": { + "control-plane-protocol": [{ + "type": "infix-routing:static", + "name": "default", + "static-routes": { + "ipv4": { + "route": [{ + "destination-prefix": "0.0.0.0/0", + "next-hop": { + "next-hop-address": "192.168.50.1" + } + }] + }, + "ipv6": { + "route": [{ + "destination-prefix": "::/0", + "next-hop": { + "next-hop-address": "2001:db8:3c4d:50::1" + } + }] + } } - } - }] + }] + } } } }) diff --git a/test/case/ietf_system/timezone/test.py b/test/case/ietf_system/timezone/test.py index 2398fd4d..e4229e75 100755 --- a/test/case/ietf_system/timezone/test.py +++ b/test/case/ietf_system/timezone/test.py @@ -14,13 +14,13 @@ with infamy.Test() as test: target = env.attach("target", "mgmt") with test.step("Set timezone to Australia/Perth"): - target.put_config_dict("ietf-system", { + target.put_config_dicts({"ietf-system": { "system": { "clock": { "timezone-name": "Australia/Perth" # always +8:00, no DTS } } - }) + }}) with test.step("Verify current time offset is +08:00"): current_datetime=target.get_current_time_with_offset() diff --git a/test/case/ietf_system/timezone_utc_offset/test.py b/test/case/ietf_system/timezone_utc_offset/test.py index 05237406..d4a3b982 100755 --- a/test/case/ietf_system/timezone_utc_offset/test.py +++ b/test/case/ietf_system/timezone_utc_offset/test.py @@ -13,13 +13,13 @@ with infamy.Test() as test: target = env.attach("target", "mgmt") with test.step("Set timezone UTC offset to +12"): - target.put_config_dict("ietf-system", { + target.put_config_dicts({"ietf-system": { "system": { "clock": { "timezone-utc-offset": "12" } } - }) + }}) with test.step("Verify current time offset is +12:00"): current_datetime=target.get_current_time_with_offset()