<!--
 Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->


{% extends 'base.html' %}
{% block content %}
    <h1>Topology</h1>

    <div class="row">
       
        <div class="col">
            {{ speakers | length }} speakers found in context <i>{{ session['context_uuid'] }}</i>
        </div>
    </div>
    
    <div class="col">
        <a href="{{ url_for('bgpls.addSpeaker') }}" class="btn btn-primary" style="margin-bottom: 10px;">
            <i class="bi bi-plus"></i>
            Add BGPLS Speaker
        </a>
    </div>
    
     <table class="table table-striped table-hover">
          <thead>
          <tr>
          <th scope="col">Speaker IP Address</th>
          <th scope="col">Speaker As Number</th>
          <th scope="col"></th>
          </tr>
          </thead>
          <tbody>
          {% if speakers %}
               {% for speaker in speakers %}
               <tr>
                    <td>{{ speaker.address }}</td>
                    <td>{{ speaker.asNumber }}</td>
                    <td>
                         <a type="button" class="btn btn-danger" href="{{ url_for('bgpls.disconnectSpeaker',speaker_address=speaker.address)}}">
                              <i class="bi bi-x-square"></i>
                         </a>
                              
                    </td>
               </tr>
               {% endfor %}
          {% else %}
               <tr>
                    <td colspan="3">No devices found</td>
               </tr>
          {% endif %}
          </tbody>
     </table>

<script src="https://d3js.org/d3.v4.min.js"></script>
    <div id="topology"></div>
    <script src="{{ url_for('js.topology_js') }}"></script>

{% endblock %}