<link rel="stylesheet" href="/static/bower_components/codemirror/addon/dialog/dialog.css">
<link rel="stylesheet" href="/static/bower_components/codemirror/addon/display/fullscreen.css">
<link rel="stylesheet" href="/static/bower_components/select2/dist/css/select2.min.css">
+ <link rel="stylesheet" href="/static/css/lwuitable.css">
{% endblock %}
{% block title_header_big %}
{{ block.super }}
{% block breadcrumb_body %}
{{ block.super }}
- <li><a href="{% url 'projects:instances:list' project_id=project_id type=type %}">Instances</a></li>
+ <li><a href="{% url 'projects:instances:list' project_id=project_id type=type %}">{{ type|upper }} Instances</a></li>
{% endblock %}
{% block content_body %}
<div class="row">
<div class="col-md-12">
- <div class="box">
- <div class="box-header with-border">
- <h3 class="box-title">Instances</h3>
+ {% if type == 'ns' %}
+ {% include 'instance_list_ns.html' %}
+ {% elif type == 'vnf' %}
+ {% include 'instance_list_vnf.html' %}
+ {% endif %}
- <div class="box-tools">
-
- <button type="button" class="btn btn-default" data-container="body"
- data-toggle="tooltip" data-placement="top" title="Instantiate NS"
- onclick="javascript:openModalCreateNS({ 'project_id':'{{project_id}}','vim_list_url': '{% url "vim:list" %}', 'nsd_list_url': '{% url "projects:list_descriptors" project_id=project_id descriptor_type='nsd' %}'})" >
- <i class="fa fa-paper-plane"></i> <span> New NS</span></button>
-
- </div>
-
- </div>
- <div class="box-body">
- <table id="instances_table" class="table table-bordered table-striped">
- <thead>
- <tr>
- <th>Id</th>
- <th>Name</th>
- <th>Nsd name</th>
- <th style="width:5%">Operational Status</th>
- <th style="width:5%">Config Status</th>
- <th>Detailed Status</th>
- <th >Actions</th>
- </tr>
- </thead>
- <tbody>
- {% for i in instances %}
- <tr>
-
- <td>{{ i|get:"_id" }}</td>
- <td>{{ i|get:"short-name" }}</td>
- <td>{{ i|get:"nsd-name-ref" }}</td>
-
- {% if i|get:"operational-status" == 'failed' %}
- <td><span class="label label-danger">{{ i|get:"operational-status" }}</span> </td>
- {% elif i|get:"operational-status" == 'init' %}
- <td><span class="label label-warning">{{ i|get:"operational-status" }}</span> </td>
- {% elif i|get:"operational-status" == 'running' %}
- <td><span class="label label-success">{{ i|get:"operational-status" }}</span> </td>
- {% else %}
- <td>{{ i|get:"operational-status" }}</td>
- {% endif %}
- {% if i|get:"config-status" == 'failed' %}
- <td><span class="label label-danger">{{ i|get:"config-status" }}</span> </td>
- {% elif i|get:"config-status" == 'init' %}
- <td><span class="label label-warning">{{ i|get:"config-status" }}</span> </td>
- {% elif i|get:"config-status" == 'running' %}
- <td><span class="label label-success">{{ i|get:"config-status" }}</span> </td>
- {% elif i|get:"config-status" == 'configured' %}
- <td><span class="label label-success">{{ i|get:"config-status" }}</span> </td>
- {% else %}
- <td>{{ i|get:"config-status" }}</td>
- {% endif %}
- <td style=" max-width:1px;overflow:hidden; white-space:nowrap; text-overflow:ellipsis;">{{ i|get:"detailed-status" }}</td>
- <td>
- <div class="btn-group">
- <button type="button" class="btn btn-default"
- onclick="javascript:showInstanceDetails('{% url 'projects:instances:show' instance_id=i|get:'_id' project_id=project_id type=type %}')"
- data-toggle="tooltip" data-placement="top" data-container="body" title="Show Info"><i
- class="fa fa-info"></i>
- </button>
-
- <button type="button" class="btn btn-default"
- onclick="javascript:deleteNs('{% url 'projects:instances:delete' instance_id=i|get:'_id' project_id=project_id type=type %}')"
- data-toggle="tooltip" data-placement="top" data-container="body" title="Delete"><i
- class="fa fa-trash-o"></i></button>
-
- <button type="button" class="btn btn-default dropdown-toggle"
- data-toggle="dropdown" aria-expanded="false">Actions
- <span class="fa fa-caret-down"></span></button>
- <ul class="dropdown-menu">
- <li><a href="#" onclick="javascript:performAction('{% url 'projects:instances:action' instance_id=i|get:'_id' project_id=project_id type=type %}')">
- <i class="fa fa-magic"></i>Exec NS Primitive</a></li>
- <li><a href="{% url 'projects:instances:ns_operations' project_id=project_id type=type instance_id=i|get:'_id'%}"> <i class="fa fa-list"></i>Active operations</a></li>
- </ul>
-
-
- </div>
-
- </td>
-
-
- </tr>
- {% endfor %}
- </tbody>
- </table>
- </div>
- </div>
</div>
</div>
--- /dev/null
+{% load get %}
+<div class="box">
+ <div class="box-header with-border">
+ <h3 class="box-title">{{ type|upper }} Instances</h3>
+
+ <div class="box-tools">
+
+ <button type="button" class="btn btn-default" data-container="body"
+ data-toggle="tooltip" data-placement="top" title="Instantiate NS"
+ onclick="javascript:openModalCreateNS({ 'project_id':'{{ project_id }}','vim_list_url': '{% url "vim:list" %}', 'nsd_list_url': '{% url "projects:list_descriptors" project_id=project_id descriptor_type='nsd' %}'})">
+ <i class="fa fa-paper-plane"></i> <span> New NS</span></button>
+
+ </div>
+
+ </div>
+ <div class="box-body">
+ <table id="instances_table" class="table table-bordered table-striped">
+ <thead>
+ <tr>
+ <th>Id</th>
+ <th>Name</th>
+ <th>Nsd name</th>
+ <th style="width:5%">Operational Status</th>
+ <th style="width:5%">Config Status</th>
+ <th>Detailed Status</th>
+ <th>Actions</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for i in instances %}
+ <tr>
+
+ <td>{{ i|get:"_id" }}</td>
+ <td>{{ i|get:"short-name" }}</td>
+ <td>{{ i|get:"nsd-name-ref" }}</td>
+
+ {% if i|get:"operational-status" == 'failed' %}
+ <td><span class="label label-danger">{{ i|get:"operational-status" }}</span></td>
+ {% elif i|get:"operational-status" == 'init' %}
+ <td><span class="label label-warning">{{ i|get:"operational-status" }}</span></td>
+ {% elif i|get:"operational-status" == 'running' %}
+ <td><span class="label label-success">{{ i|get:"operational-status" }}</span></td>
+ {% else %}
+ <td>{{ i|get:"operational-status" }}</td>
+ {% endif %}
+ {% if i|get:"config-status" == 'failed' %}
+ <td><span class="label label-danger">{{ i|get:"config-status" }}</span></td>
+ {% elif i|get:"config-status" == 'init' %}
+ <td><span class="label label-warning">{{ i|get:"config-status" }}</span></td>
+ {% elif i|get:"config-status" == 'running' %}
+ <td><span class="label label-success">{{ i|get:"config-status" }}</span></td>
+ {% elif i|get:"config-status" == 'configured' %}
+ <td><span class="label label-success">{{ i|get:"config-status" }}</span></td>
+ {% else %}
+ <td>{{ i|get:"config-status" }}</td>
+ {% endif %}
+ <td class="ellipsis" data-text="{{ i|get:"detailed-status" }}">{{ i|get:"detailed-status" }}</td>
+ <td>
+ <div class="btn-group">
+ <button type="button" class="btn btn-default"
+ onclick="javascript:showInstanceDetails('{% url 'projects:instances:show' instance_id=i|get:'_id' project_id=project_id type=type %}')"
+ data-toggle="tooltip" data-placement="top" data-container="body" title="Show Info">
+ <i
+ class="fa fa-info"></i>
+ </button>
+
+ <button type="button" class="btn btn-default"
+ onclick="javascript:deleteNs('{% url 'projects:instances:delete' instance_id=i|get:'_id' project_id=project_id type=type %}')"
+ data-toggle="tooltip" data-placement="top" data-container="body" title="Delete"><i
+ class="fa fa-trash-o"></i></button>
+
+ <button type="button" class="btn btn-default dropdown-toggle"
+ data-toggle="dropdown" aria-expanded="false">Actions
+ <span class="fa fa-caret-down"></span></button>
+ <ul class="dropdown-menu">
+ <li><a href="#"
+ onclick="javascript:performAction('{% url 'projects:instances:action' instance_id=i|get:'_id' project_id=project_id type=type %}')">
+ <i class="fa fa-magic"></i>Exec NS Primitive</a></li>
+ <li>
+ <a href="{% url 'projects:instances:ns_operations' project_id=project_id type=type instance_id=i|get:'_id' %}">
+ <i class="fa fa-list"></i>Active operations</a></li>
+ </ul>
+
+
+ </div>
+
+ </td>
+
+
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ </div>
+</div>
--- /dev/null
+{% load get %}
+{% load date_tag %}
+
+<div class="box">
+ <div class="box-header with-border">
+ <h3 class="box-title">{{ type|upper }} Instances</h3>
+
+ <div class="box-tools">
+
+
+
+ </div>
+
+ </div>
+ <div class="box-body">
+ <table id="instances_table" class="table table-bordered table-striped">
+ <thead>
+ <tr>
+ <th>Id</th>
+ <th>VNFD</th>
+ <th>Member Index</th>
+ <th>NS</th>
+ <th>Created At</th>
+ <th>Actions</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for i in instances %}
+ <tr>
+
+ <td>{{ i|get:"_id" }}</td>
+ <td><a href="javascript:openDescriptorView('{{project_id}}', 'vnfd', '{{ i|get:"vnfd-id" }}')"> {{ i|get:"vnfd-ref" }}</a></td>
+ <td>{{ i|get:"member-vnf-index-ref" }}</td>
+ <td class="ellipsis" data-text="{{ i|get:"nsr-id-ref" }}">{{ i|get:"nsr-id-ref" }}</td>
+ <td >{{ i|get:"created-time"|get_date }}</td>
+
+ <td>
+ <div class="btn-group">
+ <button type="button" class="btn btn-default"
+ onclick="javascript:showInstanceDetails('{% url 'projects:instances:show' instance_id=i|get:'_id' project_id=project_id type=type %}')"
+ data-toggle="tooltip" data-placement="top" data-container="body" title="Show Info">
+ <i class="fa fa-info"></i>
+ </button>
+
+
+ </div>
+
+ </td>
+
+
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ </div>
+</div>
client = Client()
if type == 'ns':
result = client.ns_list()
+ elif type == 'vnf':
+ result = client.vnf_list()
- return __response_handler(request, {'instances': result, 'type': 'ns', 'project_id': project_id}, 'instance_list.html')
+ return __response_handler(request, {'instances': result, 'type': type, 'project_id': project_id}, 'instance_list.html')
@login_required
def show(request, project_id=None, instance_id=None, type=None):
# result = {}
client = Client()
- result = client.ns_get(instance_id)
+ if type == 'ns':
+ result = client.ns_get(instance_id)
+ elif type == 'vnf':
+ result = client.vnf_get(instance_id)
print result
return __response_handler(request, result)
return self._send_post(_url, headers=headers,
data=open('/tmp/' + package.name, 'rb'))
return None
+
def vnf_packages_artifacts(self, id):
token = self.get_token()
if token:
return self._send_get(_url, headers=self._headers)
return None
+ def vnf_list(self):
+ token = self.get_token()
+ if token:
+ self._headers['Authorization'] = 'Bearer {}'.format(token)
+ self._headers['Content-Type'] = 'application/yaml'
+ self._headers['accept'] = 'application/json'
+ _url = "{0}/nslcm/v1/vnfrs".format(self._base_path)
+ return self._send_get(_url, headers=self._headers)
+ return None
+
+ def vnf_get(self, id):
+ token = self.get_token()
+ if token:
+ self._headers['Authorization'] = 'Bearer {}'.format(token)
+ self._headers['Content-Type'] = 'application/json'
+ self._headers['accept'] = 'application/json'
+ _url = "{0}/nslcm/v1/vnfrs/{1}".format(self._base_path, id)
+ return self._send_get(_url, headers=self._headers)
+ return None
+
def _upload_package(self, filename, package):
token = self.get_token()
headers = {}
<i class="fa fa-list fa-fw"></i><span>NS Instances</span>
</a>
</li>
+ {% url "projects:instances:list" project_id=project_id type='vnf' as instance_ns_list_url %}
+ <li {% if request.get_full_path == instance_ns_list_url %} class="active" {% endif %} >
+ <a href='{% url "projects:instances:list" project_id=project_id type="vnf"%}'>
+ <i class="fa fa-list fa-fw"></i><span>VNF Instances</span>
+ </a>
+ </li>
<li class="header">CONFIG</li>
{% url "vim:list" type='ns' as vim_list_url %}
<li {% if request.get_full_path == vim_list_url %} class="active" {% endif %}>
--- /dev/null
+.ellipsis {
+ /*display: block;*/
+ white-space: nowrap;
+ max-width: 180px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ /*transition: all .2s linear;
+ padding: .5rem 1rem;*/
+}
+/*max-width:1px;overflow:hidden; white-space:nowrap; text-overflow:ellipsis;*/
+.ellipsis:focus, .ellipsis:hover {
+ color: transparent;
+}
+
+.ellipsis:focus:after, .ellipsis:hover:after {
+ content: attr(data-text);
+ overflow: visible;
+ text-overflow: inherit;
+ background: #fff;
+ position: absolute;
+ left: auto;
+ top: auto;
+ width: auto;
+ max-width: 20rem;
+ border: 1px solid #eaebec;
+ padding: 0 .5rem;
+ box-shadow: 0 2px 4px 0 rgba(0, 0, 0, .28);
+ white-space: normal;
+ display: block;
+ color: black;
+ margin-top: -1.25rem;
+ z-index: 1;
+ user-select: text!important;
+}
+
},
error: function (result) {
dialog.modal('hide');
- bootbox.alert("An error occurred while retrieving the information for the NS");
+ bootbox.alert("An error occurred while retrieving the information.");
}
});
}