From 9b0227b882111ad46fb261f30e87326dd074ad29 Mon Sep 17 00:00:00 2001 From: Liang Zhang Date: Wed, 17 Apr 2024 14:31:33 -0500 Subject: [PATCH 1/9] Update welcom.ipynb --- jupyter/welcom.ipynb | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/jupyter/welcom.ipynb b/jupyter/welcom.ipynb index a4f41e58..6df2a6be 100644 --- a/jupyter/welcom.ipynb +++ b/jupyter/welcom.ipynb @@ -63,8 +63,7 @@ "else:\n", " print(\"The file does not exist.\")\n", " import shutil\n", - " #source_file = 'fabfed_config/fabfed_credentials_template.yml'\n", - " source_file = '/users/lzhang9/.fabfed/fabfed_credentials.yml'\n", + " source_file = 'fabfed_config/fabfed_credentials_template.yml'\n", " destination_file = 'fabfed_config/fabfed_credentials.yml'\n", " shutil.copy(source_file, destination_file)\n", " print(\"File copied successfully from\", source_file, \"to\", destination_file)" @@ -78,16 +77,6 @@ "### Edit credentials in [credential file](./fabfed_config/fabfed_credentials.yml) if needed" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "779c81b2-3260-4222-be63-7084cc386133", - "metadata": {}, - "outputs": [], - "source": [ - "!cat $file_path" - ] - }, { "cell_type": "markdown", "id": "8127923d-a615-4472-981a-fc20d01aca35", @@ -95,13 +84,14 @@ "source": [ "## Examples of FabFed Workflows\n", "### Using FabFed CLI:\n", - "\n", + "- [Cloudlab](./cloudlab.ipynb): Stiching Cloudlab and Fabric (network only) around 2 minuates\n", + "- [Chameleon](./chameleon.ipynb): Stiching Chameleon and Fabric (network only) around 2 minuates\n", + "- [Cloudlab](./cloudlab.ipynb): Stiching Cloudlab and Fabric\n", + "- [Chameleon](./chameleon.ipynb): Stiching Chameleon and Fabric\n", "- [Native aws](./native-aws.ipynb): Stiching native AWS and Fabric\n", "- [Native gcp](./native-gcp.ipynb): Stiching native GCP and Fabric\n", "- [SENSE aws](./sense-aws.ipynb): Stiching SENSE AWS and Fabric\n", "- [SENSE gcp](./sense-gcp.ipynb): Stiching SENSE GCP and Fabric\n", - "- [Cloudlab](./cloudlab.ipynb): Stiching Cloudlab and Fabric\n", - "- [Chameleon](./chameleon.ipynb): Stiching Chameleon and Fabric\n", "\n", "### Using FabFed library:\n", "- [Native aws](./native-aws-lib.ipynb): Stiching native AWS and Fabric\n", @@ -149,7 +139,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.18" + "version": "3.9.12" } }, "nbformat": 4, From ba2c98e7eef9f805f0b48638b443e24d58ef7cc7 Mon Sep 17 00:00:00 2001 From: Liang Zhang Date: Wed, 17 Apr 2024 14:33:37 -0500 Subject: [PATCH 2/9] Update native-gcp.ipynb --- jupyter/native-gcp.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jupyter/native-gcp.ipynb b/jupyter/native-gcp.ipynb index e8741bfc..f8abc8da 100644 --- a/jupyter/native-gcp.ipynb +++ b/jupyter/native-gcp.ipynb @@ -189,7 +189,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.18" + "version": "3.9.12" } }, "nbformat": 4, From 7c648fed864e36a4a1c32ca6844e47bfb453c011 Mon Sep 17 00:00:00 2001 From: Liang Zhang Date: Wed, 17 Apr 2024 14:38:34 -0500 Subject: [PATCH 3/9] Update welcom.ipynb --- jupyter/welcom.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jupyter/welcom.ipynb b/jupyter/welcom.ipynb index 6df2a6be..19526dba 100644 --- a/jupyter/welcom.ipynb +++ b/jupyter/welcom.ipynb @@ -139,7 +139,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.12" + "version": "3.9.18" } }, "nbformat": 4, From 48fdad67e315326c1b121fecb1cf51bc9643e8ee Mon Sep 17 00:00:00 2001 From: Liang Zhang Date: Wed, 17 Apr 2024 14:47:12 -0500 Subject: [PATCH 4/9] Update chameleon-lib.ipynb --- jupyter/chameleon-lib.ipynb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jupyter/chameleon-lib.ipynb b/jupyter/chameleon-lib.ipynb index c8da1de1..90606e57 100644 --- a/jupyter/chameleon-lib.ipynb +++ b/jupyter/chameleon-lib.ipynb @@ -73,6 +73,8 @@ "outputs": [], "source": [ "try:\n", + " #var_dict = dict(node_count=0)\n", + " #fabfed_manager = FabfedManager(config_dir=fab_file_path,var_dict=var_dict)\n", " fabfed_manager = FabfedManager(config_dir=fab_file_path)\n", " fabfed_manager.show_available_stitch_ports(from_provider='chi', to_provider=\"fabric\")\n", "except Exception as e:\n", From a5b11420734a449ff6d208af283a2186f65d547e Mon Sep 17 00:00:00 2001 From: Liang Zhang Date: Wed, 17 Apr 2024 14:50:51 -0500 Subject: [PATCH 5/9] Update config.fab --- jupyter/examples/cloudlab/config.fab | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jupyter/examples/cloudlab/config.fab b/jupyter/examples/cloudlab/config.fab index e5787d08..ecc785c4 100644 --- a/jupyter/examples/cloudlab/config.fab +++ b/jupyter/examples/cloudlab/config.fab @@ -31,7 +31,7 @@ resource: - fabric_network: provider: '{{ fabric.fabric_provider }}' layer3: "{{ layer3.my_layer }}" - interface: '{{ node.fabric_node }}' + #interface: '{{ node.fabric_node }}' stitch_with: '{{ network.cnet }}' - node: - fabric_node: @@ -39,11 +39,12 @@ resource: site: '{{ var.site }}' image: default_rocky_8 nic_model: NIC_Basic - count: 1 + network: "{{ network.fabric_network }}" + count: 0 - cnode: provider: '{{ cloudlab.cloudlab_provider }}' network: "{{ network.cnet }}" - count: 1 + count: 0 - service: - dtn_service: provider: '{{ janus.janus_provider }}' From 66e725d472b50673a6bce3655338b270accabd9c Mon Sep 17 00:00:00 2001 From: Liang Zhang Date: Wed, 17 Apr 2024 14:51:35 -0500 Subject: [PATCH 6/9] Update config.fab --- jupyter/examples/chameleon/star/config.fab | 23 +++------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/jupyter/examples/chameleon/star/config.fab b/jupyter/examples/chameleon/star/config.fab index af811080..4375eb88 100644 --- a/jupyter/examples/chameleon/star/config.fab +++ b/jupyter/examples/chameleon/star/config.fab @@ -1,7 +1,6 @@ variable: - node_count: - default: 1 - + default: 0 provider: - fabric: - fabric_provider: @@ -11,11 +10,6 @@ provider: - chi_provider: credential_file: ~/.fabfed/fabfed_credentials.yml profile: chi - - janus: - - janus_provider: - credential_file: ~/.fabfed/fabfed_credentials.yml - profile: janus - config: - layer3: - my_layer: @@ -29,12 +23,9 @@ resource: provider: '{{ chi.chi_provider }}' name: stitch_net layer3: "{{ layer3.my_layer }}" - count: 1 - fabric_network: provider: '{{ fabric.fabric_provider }}' - interface: '{{ node.fabric_node }}' layer3: "{{ layer3.my_layer }}" - count: 1 stitch_with: '{{ network.chi_network }}' stitch_option: site: STAR @@ -42,18 +33,10 @@ resource: - fabric_node: provider: '{{ fabric.fabric_provider }}' count: '{{ var.node_count }}' - image: default_rocky_8 + network: '{{ network.fabric_network }}' + - chi_node: provider: '{{ chi.chi_provider }}' - image: CC-Ubuntu20.04 network: '{{ network.chi_network }}' count: '{{ var.node_count }}' flavor: m1.medium - - service: - - dtn_service: - provider: '{{ janus.janus_provider }}' - node: [ '{{ node.chi_node }}', '{{ node.fabric_node }}' ] - controller: '{{ node.fabric_node }}' - image: dtnaas/tools - profile: fabfed - count: 0 From f29ac2cbd0fd93b4e6a9918cd49a413916e139ee Mon Sep 17 00:00:00 2001 From: Liang Zhang Date: Wed, 17 Apr 2024 15:03:03 -0500 Subject: [PATCH 7/9] Update gcp_network.py Patch GCP router with MD5 authentication. --- fabfed/provider/gcp/gcp_network.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fabfed/provider/gcp/gcp_network.py b/fabfed/provider/gcp/gcp_network.py index bb862cc5..9b5d6b35 100644 --- a/fabfed/provider/gcp/gcp_network.py +++ b/fabfed/provider/gcp/gcp_network.py @@ -66,6 +66,12 @@ def create(self): region=region, attachment_name=attachment_name) + # set the MD5 authentication + gcp_utils.patch_router(service_key_path=service_key_path, + project=project, + region=region, + router_name=router_name) + logger.info(f"attachment_details={attachment}") self.interface.append(dict(id=attachment.pairing_key, provider=self._provider.type)) From 3b154eff6947291e577f4885803aed3e5b43a9ee Mon Sep 17 00:00:00 2001 From: Liang Zhang Date: Wed, 17 Apr 2024 15:03:46 -0500 Subject: [PATCH 8/9] Update fabric_network.py Set GCP MTU to 1460. --- fabfed/provider/fabric/fabric_network.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fabfed/provider/fabric/fabric_network.py b/fabfed/provider/fabric/fabric_network.py index 8a70855d..a5e8a9b9 100644 --- a/fabfed/provider/fabric/fabric_network.py +++ b/fabfed/provider/fabric/fabric_network.py @@ -221,12 +221,17 @@ def handle_facility_port(self): logger.info(f"Creating Facility Port:Labels: {labels}") logger.info(f"Creating Facility Port:PeerLabels: {peer_labels}") + if cloud == "GCP": + mtu_size = 1460 + else: + mtu_size = 9001 + facility_port = self.slice_object.add_facility_port( name='Cloud-Facility-' + cloud, site=cloud, labels=labels, peer_labels=peer_labels, - capacities=Capacities(bw=50, mtu=9001)) + capacities=Capacities(bw=50, mtu=mtu_size)) logger.info("CreatedFacilityPort:" + facility_port.toJson()) else: From 1bce71634acee513d1507889117c86e3a0ca3793 Mon Sep 17 00:00:00 2001 From: Liang Zhang Date: Wed, 17 Apr 2024 15:04:45 -0500 Subject: [PATCH 9/9] Update gcp_utils.py Added the method patch_router() to set MD5 authentication. --- fabfed/provider/gcp/gcp_utils.py | 36 +++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/fabfed/provider/gcp/gcp_utils.py b/fabfed/provider/gcp/gcp_utils.py index 5fd099de..7c0def26 100644 --- a/fabfed/provider/gcp/gcp_utils.py +++ b/fabfed/provider/gcp/gcp_utils.py @@ -4,7 +4,11 @@ from google.cloud.compute_v1.types import ( Router, RouterBgp, + RouterBgpPeer, + # RouterBgpPeerBfd, + RouterMd5AuthenticationKey, InsertRouterRequest, + PatchRouterRequest, InterconnectAttachment, ) from google.oauth2 import service_account @@ -80,6 +84,35 @@ def create_router(*, service_key_path, project, region, router_name, vpc, bgp_as check_operation_result(credentials=credentials, project=project, region=region, operation_name=response.name) logger.info(f'Router {router_name} created successfully.') +def patch_router(*, service_key_path, project, region, router_name): + credentials = service_account.Credentials.from_service_account_file(service_key_path) + compute_client = compute_v1.RoutersClient(credentials=credentials) + + # Get the router resource + router = compute_client.get(project=project, region=region, router=router_name) + + # Access the BGP peers associated with the router + bgp_peers = router.bgp_peers + + # Add md5 authentication + peer = bgp_peers[0] + peer.md5_authentication_key_name = 'md5-key-name-1' + + router_resource = Router( + name=router_name, + md5_authentication_keys = [RouterMd5AuthenticationKey(key='0xzsEwC7xk6c1fK_h.xHyAdx', name='md5-key-name-1')], + bgp_peers=[peer] + ) + request = PatchRouterRequest( + project=project, + region=region, + router=router_name, + router_resource=router_resource) + response = compute_client.patch(request=request) + logger.info(f'Response={response}') + check_operation_result(credentials=credentials, project=project, region=region, operation_name=response.name) + logger.info(f'Router {router_name} patched successfully.') + def delete_router(*, service_key_path, project, region, router_name): credentials = service_account.Credentials.from_service_account_file(service_key_path) @@ -122,7 +155,8 @@ def create_interconnect_attachment(*, service_key_path, project, region, router_ admin_enabled=True, encryption=None, router=f'projects/{project}/regions/{region}/routers/{router_name}', - type_='PARTNER' + type_='PARTNER', + mtu=1460 ) request = compute_v1.InsertInterconnectAttachmentRequest(