VNFFG Manager fixes
Fixes vnf_mapping field in Tacker-Horizon. Change-Id: I8e6e33ef2dfba7bed9501704bbd8931e6b564552 Implements: blueprint tacker-vnffg Closes-Bug: #1626527
This commit is contained in:
parent
79e99e762f
commit
4c84696280
|
@ -26,11 +26,12 @@ LOG = logging.getLogger(__name__)
|
|||
class DeployVNFFG(forms.SelfHandlingForm):
|
||||
vnffg_name = forms.CharField(max_length=255, label=_("VNFFG Name"))
|
||||
vnffgd_id = forms.ChoiceField(label=_("VNFFG Catalog Name"))
|
||||
vnf_mapping = forms.MultipleChoiceField(label=_("VNF Mapping"),
|
||||
required=False)
|
||||
symmetrical = forms.BooleanField(label=_("Should a reverse path be "
|
||||
"created for the NFP"),
|
||||
required=False)
|
||||
vnf_mapping = forms.CharField(label=_("VNF Mapping"),
|
||||
required=False)
|
||||
symmetrical = forms.BooleanField(label=_("Symmetrical path"),
|
||||
required=False, help_text="Decides"
|
||||
" whether to automatically create a"
|
||||
" reverse patch for the NFP")
|
||||
|
||||
def __init__(self, request, *args, **kwargs):
|
||||
super(DeployVNFFG, self).__init__(request, *args, **kwargs)
|
||||
|
@ -51,10 +52,9 @@ class DeployVNFFG(forms.SelfHandlingForm):
|
|||
data = super(DeployVNFFG, self).clean()
|
||||
return data
|
||||
|
||||
def get_vnf(self, request, vnf):
|
||||
vnfs = api.tacker.vnf_list(self.request)
|
||||
if vnf in vnfs:
|
||||
return vnf
|
||||
def list_vnfs(self, request):
|
||||
vnfs = [vnfs['name'] for vnfs in api.tacker.vnf_list(request)]
|
||||
return vnfs
|
||||
|
||||
def handle(self, request, data):
|
||||
try:
|
||||
|
@ -66,7 +66,16 @@ class DeployVNFFG(forms.SelfHandlingForm):
|
|||
_vnf_mappings = vnf_mapping.split(",")
|
||||
for mapping in _vnf_mappings:
|
||||
vnfd_name, vnf = mapping.split(":", 1)
|
||||
_vnf_mapping[vnfd_name] = self.get_vnf(request, vnf)
|
||||
# Check if specified VNF exists
|
||||
vnfs = self.list_vnfs(request)
|
||||
try:
|
||||
if vnf in vnfs:
|
||||
_vnf_mapping[vnfd_name] = vnf
|
||||
else:
|
||||
raise Exception
|
||||
except Exception:
|
||||
exceptions.handle(request, _('Specified VNF %s not'
|
||||
' found') % vnf)
|
||||
|
||||
symmetrical = data['symmetrical']
|
||||
vnffg_arg = {'vnffg': {'vnffgd_id': vnffgd_id,
|
||||
|
|
|
@ -6,10 +6,8 @@
|
|||
{% block modal-body-right %}
|
||||
<h3>{% trans "Description:" %}</h3>
|
||||
<p>{% blocktrans %} Deploys a VNFFG.<br/>
|
||||
If the VNFFGD template is parameterized,
|
||||
upload a yaml file with values for those parameters.<br/>
|
||||
If the VNFFGD template is not parameterized, any
|
||||
yaml file uploaded will be ignored.<br/>
|
||||
If a configuration yaml file is uploaded, it will be
|
||||
applied to the VNFFG post its successful creation.{% endblocktrans %}</p>
|
||||
VNF Mapping is a list of logical VNFD name to VNF instance name
|
||||
mapping. Example<br/>
|
||||
VNFD1:VNF1, VNFD2: VNF2<br/>
|
||||
{% endblocktrans %}</p>
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue