From 967bfc1e6734e642021b402e83844726ee478d80 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Thu, 24 Oct 2024 07:41:56 +0200 Subject: [PATCH] test: new test, verify ifAlias Signed-off-by: Joachim Wiberg --- test/case/ietf_interfaces/Readme.adoc | 2 + .../case/ietf_interfaces/ietf_interfaces.yaml | 3 ++ test/case/ietf_interfaces/ifalias/Readme.adoc | 25 +++++++++++ test/case/ietf_interfaces/ifalias/test.py | 36 ++++++++++++++++ .../case/ietf_interfaces/ifalias/topology.dot | 1 + .../case/ietf_interfaces/ifalias/topology.svg | 42 +++++++++++++++++++ 6 files changed, 109 insertions(+) create mode 100644 test/case/ietf_interfaces/ifalias/Readme.adoc create mode 100755 test/case/ietf_interfaces/ifalias/test.py create mode 120000 test/case/ietf_interfaces/ifalias/topology.dot create mode 100644 test/case/ietf_interfaces/ifalias/topology.svg diff --git a/test/case/ietf_interfaces/Readme.adoc b/test/case/ietf_interfaces/Readme.adoc index f19f093bf..df395c9d6 100644 --- a/test/case/ietf_interfaces/Readme.adoc +++ b/test/case/ietf_interfaces/Readme.adoc @@ -11,6 +11,8 @@ include::ipv6_address/Readme.adoc[] include::ipv4_autoconf/Readme.adoc[] +include::ifalias/Readme.adoc[] + include::iface_phys_address/Readme.adoc[] include::routing_basic/Readme.adoc[] diff --git a/test/case/ietf_interfaces/ietf_interfaces.yaml b/test/case/ietf_interfaces/ietf_interfaces.yaml index a512bc277..9118da669 100644 --- a/test/case/ietf_interfaces/ietf_interfaces.yaml +++ b/test/case/ietf_interfaces/ietf_interfaces.yaml @@ -8,6 +8,9 @@ - name: ipv6_address case: ipv6_address/test.py +- name: ifalias + case: ifalias/test.py + - name: iface_phys_address case: iface_phys_address/test.py diff --git a/test/case/ietf_interfaces/ifalias/Readme.adoc b/test/case/ietf_interfaces/ifalias/Readme.adoc new file mode 100644 index 000000000..02209f91d --- /dev/null +++ b/test/case/ietf_interfaces/ifalias/Readme.adoc @@ -0,0 +1,25 @@ +=== Interface Description (ifAlias) +==== Description +Verify interface description (ifAlias) can be set on an interface and +then be read back from the operational datastore. + +==== Topology +ifdef::topdoc[] +image::../../test/case/ietf_interfaces/ifalias/topology.svg[Interface Description (ifAlias) topology] +endif::topdoc[] +ifndef::topdoc[] +ifdef::testgroup[] +image::ifalias/topology.svg[Interface Description (ifAlias) topology] +endif::testgroup[] +ifndef::testgroup[] +image::topology.svg[Interface Description (ifAlias) topology] +endif::testgroup[] +endif::topdoc[] +==== Test sequence +. Set up topology and attach to target DUT +. Set up interface target:data with description +. Verify description can be read back from operational + + +<<< + diff --git a/test/case/ietf_interfaces/ifalias/test.py b/test/case/ietf_interfaces/ifalias/test.py new file mode 100755 index 000000000..83c12f425 --- /dev/null +++ b/test/case/ietf_interfaces/ifalias/test.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 +"""Interface Description (ifAlias) + +Verify interface description (ifAlias) can be set on an interface and +then be read back from the operational datastore. +""" +import infamy +import infamy.iface as iface + +with infamy.Test() as test: + with test.step("Set up topology and attach to target DUT"): + env = infamy.Env() + target = env.attach("target", "mgmt") + DESC = "Kilroy was here" + + with test.step("Set up interface target:data with description"): + _, tport = env.ltop.xlate("target", "data") + + target.put_config_dict("ietf-interfaces", { + "interfaces": { + "interface": [ + { + "name": tport, + "description": DESC, + "enabled": True, + } + ] + } + }) + + with test.step("Verify description can be read back from operational"): + text = iface.get_param(target, tport, "description") + if text != DESC: + test.fail() + + test.succeed() diff --git a/test/case/ietf_interfaces/ifalias/topology.dot b/test/case/ietf_interfaces/ifalias/topology.dot new file mode 120000 index 000000000..4f53d15af --- /dev/null +++ b/test/case/ietf_interfaces/ifalias/topology.dot @@ -0,0 +1 @@ +../../../infamy/topologies/1x2.dot \ No newline at end of file diff --git a/test/case/ietf_interfaces/ifalias/topology.svg b/test/case/ietf_interfaces/ifalias/topology.svg new file mode 100644 index 000000000..ff3d246be --- /dev/null +++ b/test/case/ietf_interfaces/ifalias/topology.svg @@ -0,0 +1,42 @@ + + + + + + +1x2 + + + +host + +host + +mgmt + +data + + + +target + +mgmt + +data + +target + + + +host:mgmt--target:mgmt + + + + +host:data--target:data + + + +