Resolve "(CTTC) Enhanced NETCONF-OpenConfig SBI Driver for DSCM Pluggables"

Closes #305 (closed)

Merge request reports

Loading
+1 −0
Changes for proto/pluggables.proto: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ message PluggableConfig {
  double center_frequency_mhz                      = 3;   // center frequency in MHz
  int32  operational_mode                          = 4;   // e.g., 0=off and 1=on 
  int32  line_port                                 = 5;   // line port number
  string channel_name                              = 6;   // channel name
  repeated DigitalSubcarrierGroupConfig dsc_groups = 10;
}

+5 −2
Changes for scripts/run_tests_locally-service-pluggable.sh: 5 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -17,7 +17,10 @@ PROJECTDIR=`pwd`
cd $PROJECTDIR/src
RCFILE=$PROJECTDIR/coverage/.coveragerc

python3 -m pytest --log-level=info --log-cli-level=info --verbose \
    pluggables/tests/test_Pluggables.py
# to run integration test: -m integration
python3 -m pytest --log-level=info --log-cli-level=info --verbose -m "not integration" \
    pluggables/tests/test_pluggables_with_SBI.py
# python3 -m pytest --log-level=info --log-cli-level=info --verbose \
#     pluggables/tests/test_Pluggables.py

echo "Bye!"
+31 −0
Changes for src/device/service/drivers/openconfig/templates/pluggable/1/config/edit_config.xml: 31 added lines, 0 removed lines.
Original line number Diff line number Diff line
<components xmlns="http://openconfig.net/yang/platform">
    <component{% if operation is defined %} xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="{{operation}}"{% endif %}>
        <name>{{name}}</name>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device-digital-subcarriers">
            {% if operation is defined and operation != 'delete' %}
            <config>
                {% if frequency is defined %}<frequency>{{frequency}}</frequency>{% endif %}
                {% if target_output_power is defined %}<target-output-power>{{target_output_power}}</target-output-power>{% endif %}
                {% if operational_mode is defined %}<operational-mode>{{operational_mode}}</operational-mode>{% endif %}

                {% if digital_sub_carriers_group is defined and digital_sub_carriers_group %}
                    {% for group in digital_sub_carriers_group %}
                    <digital-subcarriers-group>
                        <digital-subcarriers-group-id>{{group.digital_sub_carriers_group_id}}</digital-subcarriers-group-id>

                        {% if group.digital_sub_carrier_id is defined and group.digital_sub_carrier_id %}
                            {% for sub_carrier in group.digital_sub_carrier_id %}
                            <digital-subcarrier-id>
                                <subcarrier-id>{{sub_carrier.sub_carrier_id}}</subcarrier-id>
                                <active>{{sub_carrier.active}}</active>
                            </digital-subcarrier-id>
                            {% endfor %}
                        {% endif %}
                    </digital-subcarriers-group>
                    {% endfor %}
                {% endif %}
            </config>
            {% endif %}
        </optical-channel>
    </component>
</components>
+2 −0
Changes for src/device/service/drivers/openconfig/templates/Namespace.py: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ NAMESPACE_POLICY_TYPES_2 = 'http://openconfig.net/yang/policy_types'
NAMESPACE_ROUTING_POLICY                      = 'http://openconfig.net/yang/routing-policy'
NAMESPACE_VLAN                                = 'http://openconfig.net/yang/vlan'
NAMESPACE_PLATFORM_TRANSCEIVER                = 'http://openconfig.net/yang/platform/transceiver'
NAMESPACE_TERMINAL_DEVICE_DIGITAL_SUBCARRIERS = 'http://openconfig.net/yang/terminal-device-digital-subcarriers'

NAMESPACES = {
    'nc'   : NAMESPACE_NETCONF,
@@ -46,4 +47,5 @@ NAMESPACES = {
    'ocrp' : NAMESPACE_ROUTING_POLICY,
    'ocv'  : NAMESPACE_VLAN,
    'ocptr': NAMESPACE_PLATFORM_TRANSCEIVER,
    'octds': NAMESPACE_TERMINAL_DEVICE_DIGITAL_SUBCARRIERS,
}
+8 −0
Changes for src/device/service/drivers/openconfig/templates/__init__.py: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -136,6 +136,14 @@ def compose_config( # template generation
                templates.append(JINJA_ENV.get_template(enable_ingress_filter_path))
                templates.append(JINJA_ENV.get_template(acl_entry_path))
                templates.append(JINJA_ENV.get_template(acl_ingress_path))
        elif "pluggable" in resource_key:  # MANAGING DSCM (Digital Subcarrier Modules)
            # Use generic pluggable template for all devices (hub and leaf)
            # Resource key format: /pluggable/{template_index}/config
            template_name = '{:s}/edit_config.xml'.format(RE_REMOVE_FILTERS.sub('', resource_key))
            templates.append(JINJA_ENV.get_template(template_name))
            LOGGER.info(f"Loading DSCM template: {template_name}")
            
            data : Dict[str, Any] = json.loads(resource_value)
        else:
            template_name = '{:s}/edit_config.xml'.format(RE_REMOVE_FILTERS.sub('', resource_key))
            templates.append(JINJA_ENV.get_template(template_name))
Loading
Loading