Commit 9283fcb0 authored by Sebastien Merle's avatar Sebastien Merle
Browse files

Update TE service configuration format

parent 84aa2f54
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -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;
    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.
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@

    {tfte, [
        {context, <<"admin">>},
        {topology, <<"tetestbed">>},
        {topology, <<"admin">>},
        {services, [
            {te, [
                {http, {env, "TESERVICE_SERVICE_HOST"}, {env, "TESERVICE_SERVICE_PORT_GRPC"}, []}
+7 −13
Original line number Diff line number Diff line
@@ -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"}}}
            ]}
        }
    ],