Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove overlay field from Sliver rspec. #1

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*~
*.pyc
*.save
*.swp
7 changes: 1 addition & 6 deletions clab/clab_aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def allocate(self, slice_urn, rspec_string, expiration, credentials={}, options=
# parse RSpec (if rspec_string argument)
rspec = RSpec(rspec_string, version=rspec_version)
# nodes in which the slivers will be created (list of dict)
# the dict contains a 'slivers' field, a list of dicts with info about slivers (template, overlay, sliver_interfaces)
# the dict contains a 'slivers' field, a list of dicts with info about slivers (template, sliver_interfaces)
nodes_with_slivers = rspec.version.get_nodes_with_slivers()
# ignore slice attributes...
requested_attributes = rspec.version.get_slice_attributes()
Expand Down Expand Up @@ -1512,10 +1512,6 @@ def clab_sliver_to_rspec_sliver(self, sliver, options={}):
template_uri = self.driver.testbed_shell.get_slice_by(slice_uri=sliver['slice']['uri'])['template']
template = self.driver.testbed_shell.get_template_by(template_uri=template_uri['uri'])
rspec_sliver['template'] = {'name':template['name'], 'id':template['id'], 'type':template['type']}
# Overlay
overlay = sliver.get('overlay')
if overlay:
rspec_sliver['overlay'] = {'uri':overlay['uri']}
# Interfaces
rspec_sliver['interfaces'] = sliver['interfaces']

Expand Down Expand Up @@ -1548,7 +1544,6 @@ def clab_slivers_to_rspec_slivers(self, node, options={}):

# EXTENSION FOR CLab v1 RSpec
# Template
# Overlay
# Interfaces

rspec_slivers.append(rspec_sliver)
Expand Down
15 changes: 4 additions & 11 deletions clab/clab_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
@author: gerard
'''

import time
import requests
import time

from orm.api import Api
from orm.resources import Resource
Expand Down Expand Up @@ -564,9 +564,7 @@ def get_node_current_state(self, node=None, node_uri=None):

node_no_serialized = self.get_by_uri_no_serialized(node_uri)
state_link = node_no_serialized.get_links()['http://confine-project.eu/rel/controller/state']
from ast import literal_eval
# content.split('{"current": "')[1].split('"')[0]
current_state = literal_eval(controller.get(state_link).content.replace('null','"null"'))
current_state = controller.get(state_link).json()
return current_state['current']


Expand Down Expand Up @@ -594,8 +592,7 @@ def get_sliver_current_state(self, sliver=None, sliver_uri=None):

sliver_no_serialized = self.get_by_uri_no_serialized(sliver_uri)
state_link = sliver_no_serialized.get_links()['http://confine-project.eu/rel/controller/state']
from ast import literal_eval
current_state = literal_eval(controller.get(state_link).content.replace('null','"null"'))
current_state = controller.get(state_link).json()
return current_state['current']


Expand Down Expand Up @@ -884,7 +881,7 @@ def create_slice(self, name, group_uri=None, template_uri=None, fields={}, prope
template = self.get_by_uri(template_uri)
else:
template = self.get_template_by(template_name=self.default_template)
sliver_defaults={"instance_sn": 0, "data_uri": "","overlay_uri": "",
sliver_defaults={"instance_sn": 0, "data_uri": "",
"template": {"uri": template['uri'],"id": template['id']}}

# Create slice
Expand Down Expand Up @@ -1163,8 +1160,6 @@ def update_slice(self, slice_uri, fields):
slice.update(vlan_nr=fields[key])
elif key=='exp_data_uri':
slice.update(exp_data_uri=fields[key])
elif key=='overlay_uri':
slice.update(overlay_uri=fields[key])
elif key=='name':
slice.update(name=fields[key])
elif key=='description':
Expand Down Expand Up @@ -1198,8 +1193,6 @@ def update_sliver(self, sliver_uri, fields):
sliver.update(interfaces=fields[key])
elif key=='exp_data_uri':
sliver.update(exp_data_uri=fields[key])
elif key=='overlay_uri':
sliver.update(overlay_uri=fields[key])
elif key=='name':
sliver.update(name=fields[key])
elif key=='description':
Expand Down
11 changes: 0 additions & 11 deletions rspec/clabv1Sliver.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from sfa.rspecs.elements.versions.clabv1SliverParameters import Clabv1SliverParameters
from sfa.rspecs.elements.versions.clabv1SliverParameters import Clabv1Template
from sfa.rspecs.elements.versions.clabv1SliverParameters import Clabv1Overlay
from sfa.rspecs.elements.versions.clabv1SliverParameters import Clabv1NetworkInterface


Expand Down Expand Up @@ -48,10 +47,6 @@ def add_slivers(xml, slivers):
template = sliver.get('template')
if template:
sliver_parameters_elem.add_element('{%s}template'%xml.namespaces['clab'], name=template['name'], id=str(template['id']), type=template['type'])
# overlay
overlay = sliver.get('overlay')
if overlay:
sliver_parameters_elem.add_element('{%s}overlay'%xml.namespaces['clab'], name=overlay['uri'], uri=overlay['uri'])
# interfaces
#sliver_interfaces_elem = sliver_parameters_elem.add_element('{%s}sliver_interfaces'%xml.namespaces['clab'])
interfaces = sliver.get('interfaces')
Expand Down Expand Up @@ -103,12 +98,6 @@ def get_slivers(xml, filter={}):
template_elem = template_elems[0]
template = dict(template_elem.get_instance(Clabv1Template))
sliver['template'] = template
# get the overlay element
overlay_elems = sliver_parameters_elem.xpath('./clab:overlay | ./overlay', namespaces=xml.namespaces)
if overlay_elems:
overlay_elem = overlay_elems[0]
overlay = dict(overlay_elem.get_instance(Clabv1Overlay))
sliver['overlay'] = overlay
# get the sliver interfaces element (list of SliverInterface elems)
#sliver_interfaces_elems = sliver_parameters_elem.xpath('./clab:sliver_interfaces | ./sliver_interfaces', namespaces=xml.namespaces)
#if sliver_interfaces_elems:
Expand Down
11 changes: 1 addition & 10 deletions rspec/clabv1SliverParameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
class Clabv1SliverParameters(Element):
fields = [
'template',
'overlay',
'sliver_interfaces',
]

Expand All @@ -20,17 +19,9 @@ class Clabv1Template(Element):
]


class Clabv1Overlay(Element):
fields = [
'file',
'uri',
'sha256',
]


class Clabv1NetworkInterface(Element):
fields = [
'name',
'type',
'nr',
]
]