diff --git a/src/te/apps/tfte/src/tfte_topology.erl b/src/te/apps/tfte/src/tfte_topology.erl index 886fd926dba1f4841bc78d44ee3ecab295850fc2..d9505e914f390ca0bfadce3992c0118ef7e6d07f 100644 --- a/src/te/apps/tfte/src/tfte_topology.erl +++ b/src/te/apps/tfte/src/tfte_topology.erl @@ -281,18 +281,23 @@ device_status(#{device_operational_status := 'DEVICEOPERATIONALSTATUS_ENABLED'}) enabled. device_mpls_label(Device) -> - try device_config_value(<<"/te_data/mpls_label">>, Device) + try device_config_value(<<"/te_data">>, Device) of + Map when is_map(Map) -> maps:get(<<"mpls_label">>, Map, undefined); + _ -> undefined catch error:badarg -> undefined end. device_pcc_address(Device) -> - try device_config_value(<<"/te_data/pcc_address">>, Device) of - undefined -> undefined; - AddressBin -> - case inet_parse:address(binary_to_list(AddressBin)) of - {ok, Address} -> Address; - {error,einval} -> undefined - end + try device_config_value(<<"/te_data">>, Device) of + Map when is_map(Map) -> + case maps:get(<<"pcc_address">>, Map, undefined) of + AddressBin -> + case inet_parse:address(binary_to_list(AddressBin)) of + {ok, Address} -> Address; + {error,einval} -> undefined + end + end; + _ -> undefined catch error:badarg -> undefined end. diff --git a/src/te/config/sys.config.src b/src/te/config/sys.config.src index f3c18564177e11bcf21f4fab4d45e905f806060c..b1640c10927cd3951e3cbde2bf501d8d91454fdf 100644 --- a/src/te/config/sys.config.src +++ b/src/te/config/sys.config.src @@ -2,7 +2,7 @@ {tfte, [ {context, <<"admin">>}, - {topology, <<"tetestbed">>}, + {topology, <<"admin">>}, {services, [ {te, [ {http, {env, "TESERVICE_SERVICE_HOST"}, {env, "TESERVICE_SERVICE_PORT_GRPC"}, []} diff --git a/src/te/tests/topology-descriptors.json b/src/te/tests/topology-descriptors.json index 82f37ce295894c00831ba85b0ee059144b4f1c98..a34d8ce09b3367bce0943ef3de8565baec776842 100644 --- a/src/te/tests/topology-descriptors.json +++ b/src/te/tests/topology-descriptors.json @@ -8,7 +8,7 @@ ], "topologies": [ { - "topology_id": {"topology_uuid": {"uuid": "tetestbed"}, "context_id": {"context_uuid": {"uuid": "admin"}}}, + "topology_id": {"topology_uuid": {"uuid": "admin"}, "context_id": {"context_uuid": {"uuid": "admin"}}}, "device_ids": [ {"device_uuid": {"uuid": "SW1"}}, {"device_uuid": {"uuid": "RT1"}}, @@ -54,8 +54,7 @@ {"sample_types": [], "type": "copper", "uuid": "eth-src"}, {"sample_types": [], "type": "copper", "uuid": "eth-sw1"} ]}}}, - {"action": 1, "custom": {"resource_key": "/te_data/mpls_label", "resource_value": "16010"}}, - {"action": 1, "custom": {"resource_key": "/te_data/pcc_address", "resource_value": "1.1.1.1"}} + {"action": 1, "custom": {"resource_key": "/te_data", "resource_value": {"mpls_label": 16010, "pcc_address": "1.1.1.1"}}} ]} }, { @@ -69,8 +68,7 @@ {"sample_types": [], "type": "copper", "uuid": "eth-rt4-1"}, {"sample_types": [], "type": "copper", "uuid": "eth-rt4-2"} ]}}}, - {"action": 1, "custom": {"resource_key": "/te_data/mpls_label", "resource_value": "16020"}}, - {"action": 1, "custom": {"resource_key": "/te_data/pcc_address", "resource_value": "2.2.2.2"}} + {"action": 1, "custom": {"resource_key": "/te_data", "resource_value": {"mpls_label": 16020, "pcc_address": "2.2.2.2"}}} ]} }, { @@ -84,8 +82,7 @@ {"sample_types": [], "type": "copper", "uuid": "eth-rt5-1"}, {"sample_types": [], "type": "copper", "uuid": "eth-rt5-2"} ]}}}, - {"action": 1, "custom": {"resource_key": "/te_data/mpls_label", "resource_value": "16030"}}, - {"action": 1, "custom": {"resource_key": "/te_data/pcc_address", "resource_value": "3.3.3.3"}} + {"action": 1, "custom": {"resource_key": "/te_data", "resource_value": {"mpls_label": 16030, "pcc_address": "3.3.3.3"}}} ]} }, { @@ -100,8 +97,7 @@ {"sample_types": [], "type": "copper", "uuid": "eth-rt5"}, {"sample_types": [], "type": "copper", "uuid": "eth-rt6"} ]}}}, - {"action": 1, "custom": {"resource_key": "/te_data/mpls_label", "resource_value": "16040"}}, - {"action": 1, "custom": {"resource_key": "/te_data/pcc_address", "resource_value": "4.4.4.4"}} + {"action": 1, "custom": {"resource_key": "/te_data", "resource_value": {"mpls_label": 16040, "pcc_address": "4.4.4.4"}}} ]} }, { @@ -116,8 +112,7 @@ {"sample_types": [], "type": "copper", "uuid": "eth-rt4"}, {"sample_types": [], "type": "copper", "uuid": "eth-rt6"} ]}}}, - {"action": 1, "custom": {"resource_key": "/te_data/mpls_label", "resource_value": "16050"}}, - {"action": 1, "custom": {"resource_key": "/te_data/pcc_address", "resource_value": "5.5.5.5"}} + {"action": 1, "custom": {"resource_key": "/te_data", "resource_value": {"mpls_label": 16050, "pcc_address": "5.5.5.5"}}} ]} }, { @@ -131,8 +126,7 @@ {"sample_types": [], "type": "copper", "uuid": "eth-rt5"}, {"sample_types": [], "type": "copper", "uuid": "eth-dst"} ]}}}, - {"action": 1, "custom": {"resource_key": "/te_data/mpls_label", "resource_value": "16060"}}, - {"action": 1, "custom": {"resource_key": "/te_data/pcc_address", "resource_value": "6.6.6.6"}} + {"action": 1, "custom": {"resource_key": "/te_data", "resource_value": {"mpls_label": 16060, "pcc_address": "6.6.6.6"}}} ]} } ],