Skip to content

Commit

Permalink
added stitching-chameleon-cloudlab-via-fabric config file
Browse files Browse the repository at this point in the history
  • Loading branch information
abessiari committed Jul 24, 2024
1 parent e2dca64 commit 8f780ea
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 17 deletions.
51 changes: 51 additions & 0 deletions examples/demos/stitching-chameleon-cloudlab-via-fabric/config.fab
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
provider:
- cloudlab:
- cloudlab_provider:
credential_file: ~/.fabfed/fabfed_credentials.yml
profile: cloudlab
- fabric:
- fabric_provider:
credential_file: ~/.fabfed/fabfed_credentials.yml
profile: fabric
- chi:
- chi_provider:
credential_file: ~/.fabfed/fabfed_credentials.yml
profile: chi

config:
- layer3:
- my_layer:
subnet: 192.168.1.0/24
gateway: 192.168.1.1
ip_start: 192.168.1.2
ip_end: 192.168.1.254
resource:
- network:
- cnet:
provider: '{{cloudlab.cloudlab_provider }}'
layer3: "{{ layer3.my_layer }}"
- fabric_network:
provider: '{{ fabric.fabric_provider }}'
layer3: "{{ layer3.my_layer }}"
stitch_with:
- network: '{{ network.chi_network }}'
stitch_option:
site: TACC
- network: '{{ network.cnet }}'
stitch_option:
site: UTAH
- chi_network:
provider: '{{ chi.chi_provider }}'
name: stitch_net
layer3: "{{ layer3.my_layer }}"
- node:
- cloudlab_node:
provider: '{{ cloudlab.cloudlab_provider }}'
network: "{{ network.cnet }}"
count: 1
- chi_node:
provider: '{{ chi.chi_provider }}'
image: CC-Ubuntu20.04
network: '{{ network.chi_network }}'
flavor: m1.medium
count: 1
37 changes: 21 additions & 16 deletions fabfed/controller/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,15 @@ def partition_layer3_config(*, networks: list):
dhcp_start = dhcp_end + 1


def find_peer_network(*, network):
def find_peer_networks(*, network):
dependencies = network.dependencies
peer_networks = []

for ed in dependencies:
if ed.key == Constants.RES_STITCH_INTERFACE:
return ed.resource
peer_networks.append(ed.resource)

return None
return peer_networks


def find_nodes_related_to_network(*, network, resources):
Expand All @@ -99,29 +100,33 @@ def find_node_clusters(*, resources):

for net in networks:
if net.label not in visited_networks:
peer = find_peer_network(network=net)
peers = find_peer_networks(network=net)

if peer:
if peers:
cluster = []
visited_networks.append(net.label)
nodes = find_nodes_related_to_network(network=net, resources=resources)
visited_networks.append(peer.label)
nodes.extend(find_nodes_related_to_network(network=peer, resources=resources))
visited_nodes.extend([n.label for n in nodes])
cluster.extend(nodes)

if nodes:
clusters.append(nodes)
for peer in peers:
visited_networks.append(peer.label)
nodes = find_nodes_related_to_network(network=peer, resources=resources)
visited_nodes.extend([n.label for n in nodes])

if nodes:
cluster.extend(nodes)

if cluster:
clusters.append(cluster)

for net in networks:
if net.label not in visited_networks:
peer = find_peer_network(network=net)
nodes = find_nodes_related_to_network(network=net, resources=resources)

if not peer:
visited_networks.append(net.label)
nodes = find_nodes_related_to_network(network=net, resources=resources)
if nodes:
visited_nodes.extend([n.label for n in nodes])

if nodes:
clusters.append(nodes)
clusters.append(nodes)

nodes = [r for r in resources if r.is_node]

Expand Down
2 changes: 1 addition & 1 deletion fabfed/provider/fabric/fabric_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def __init__(self, label, provider: FabricProvider, slice_object: Slice, name, r
logger.info(f'Network {self.net_name} found interface {interface}')
self.vlan = interface.get('vlan')

if self.stitch_port:
if isinstance(self.stitch_port, dict):
self.device = self.stitch_port.get(Constants.STITCH_PORT_DEVICE_NAME)
self.site = self.stitch_port.get(Constants.STITCH_PORT_SITE)

Expand Down

0 comments on commit 8f780ea

Please sign in to comment.