Commit fc3780c9 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Merge branch 'develop' of https://labs.etsi.org/rep/tfs/controller into...

Merge branch 'develop' of https://labs.etsi.org/rep/tfs/controller into feat/1-cttc-forecaster-component
parents d31fdd76 dcaf1e5e
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -109,6 +109,9 @@ class NetconfSessionHandler:
    @RETRY_DECORATOR
    def get(self, filter=None, with_defaults=None): # pylint: disable=redefined-builtin
        with self.__lock:
            if self.__vendor == 'JUNIPER'and not 'component' in str(filter):
                return self.__manager.get_config(source="running", filter=filter, with_defaults=with_defaults)
            else:
                return self.__manager.get(filter=filter, with_defaults=with_defaults)

    @RETRY_DECORATOR
+1 −3
Original line number Diff line number Diff line
@@ -89,9 +89,7 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]:
            add_value_from_tag(inventory['attributes'], 'empty', component_empty)

        component_parent = xml_component.find('ocp:state/ocp:parent', namespaces=NAMESPACES)
        if component_parent is None or component_parent.text is None:
            add_value_from_tag(inventory, 'parent-component-references', component_type)
        else:
        if not component_parent is None: 
            add_value_from_tag(inventory, 'parent-component-references', component_parent)

        component_HW = xml_component.find('ocp:state/ocp:hardware-version', namespaces=NAMESPACES)
+10 −0
Original line number Diff line number Diff line
@@ -150,6 +150,16 @@ def detail(device_uuid: str):
    return render_template(
        'device/detail.html', device=device_obj, dde=DeviceDriverEnum, dose=DeviceOperationalStatusEnum)
    
@device.route('inventory/<path:device_uuid>', methods=['GET', 'POST'])
def inventory(device_uuid: str):
    context_client.connect()
    device_obj = get_device(context_client, device_uuid, rw_copy=False)
    if device_obj is None:
        flash('Device({:s}) not found'.format(str(device_uuid)), 'danger')
        device_obj = Device()
    context_client.close()
    return render_template('device/inventory.html', device=device_obj)

@device.get('<path:device_uuid>/delete')
def delete(device_uuid):
    try:
+0 −36
Original line number Diff line number Diff line
@@ -86,42 +86,6 @@
            </tbody>
        </table>
    </div>
    {% if device.components|length > 0 %}
    <div class="col-sm-8">
        <table class="table table-striped table-hover">
            <thead>
                <tr>
                    <th scope="col">Component UUID</th>
                    <th scope="col">Name</th>
                    <th scope="col">Type</th>
                    <th scope="col">Parent</th>
                    <th scope="col">Attributes</th>
                </tr>
            </thead>
            <tbody>
                {% for component in device.components %}
                <tr>
                    <td>
                        {{ component.component_uuid.uuid }}
                    </td>
                    <td>
                        {{ component.name }}
                    </td>
                    <td>
                        {{ component.type }}
                    </td>
                    <td>
                        {{ component.parent }}
                    </td>
                    <td>
                        {{ component.attributes }}
                    </td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
    {% endif %}
</div>

<b>Configurations:</b>
+9 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@
            <th scope="col">Status</th>
            <th scope="col">Config Rules</th>
            <th scope="col"></th>
            <th scope="col"></th>
          </tr>
        </thead>
        <tbody>
@@ -74,6 +75,14 @@
                            </svg>
                        </a>
                    </td>
                    <td>
                        <a href="{{ url_for('device.inventory', device_uuid=device.device_id.device_uuid.uuid) }}">
                            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pci-card" viewBox="0 0 16 16">
                                <path d="M0 1.5A.5.5 0 0 1 .5 1h1a.5.5 0 0 1 .5.5V4h13.5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-.5.5H2v2.5a.5.5 0 0 1-1 0V2H.5a.5.5 0 0 1-.5-.5Z"/>
                                <path d="M3 12.5h3.5v1a.5.5 0 0 1-.5.5H3.5a.5.5 0 0 1-.5-.5v-1Zm4 0h4v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1Z"/>
                              </svg>
                        </a>
                    </td>
                </tr>
                {% endfor %}
            {% else %}
Loading