Commit a83d6df4 authored by Javier Velázquez's avatar Javier Velázquez
Browse files

Added hackfest7 files

parent d57a1a97
Loading
Loading
Loading
Loading
+120 −0
Original line number Original line Diff line number Diff line
# Teraflow & NSC Hackfest Setup Guide

This tutorial guides you through importing and configuring a virtual machine in VirtualBox, setting up the Teraflow and NSC environments, and interacting with the respective services via browser and API.

## 1. Import the Virtual Machine

1. Open **VirtualBox 7.0**.
2. Double-click the `.ova` file to import the virtual machine.
3. While the VM is being imported, proceed to configure the network.

## 2. Configure NAT Network

1. Go to **File → Tools → Network Manager**.
2. Under **NAT Networks**, click **Create**.
3. Set the following:
   - **Name**: `TFS-NAT-Net`
   - **IPv4 Prefix**: `10.0.2.0/24`
   - Leave all other options **unchecked**.
4. Click on **Port Forwarding** and add the following rules:

| Name  | Protocol | Host IP     | Host Port | Guest IP    | Guest Port |
|-------|----------|-------------|-----------|-------------|------------|
| HTTP  | TCP      | 127.0.0.1   | 8080      | 10.0.2.10   | 80         |
| SSH   | TCP      | 127.0.0.1   | 2200      | 10.0.2.10   | 22         |

## 3. Attach the NAT Network to the VM

1. Right-click the imported virtual machine → **Settings → Network**.
2. Enable **Adapter 1**.
3. Set:
   - **Attached to**: `NAT Network`
   - **Name**: `TFS-NAT-Net`

## 4. Start the Virtual Machine

- Boot the VM from VirtualBox.

## 5. Set Up Visual Studio Code

1. Ensure the **Remote Development** extension is installed.
2. Click the green box in the lower-left corner → **Connect to Host → Configure SSH Hosts**.
3. Add the following to your SSH config:

   ```
   Host TFS-VM
       HostName localhost
       Port 2200
       User tfs
   ```

4. Save and click **Connect to Host → TFS-VM**.
5. Enter the password: `tfs123`.

## 6. Verify Teraflow Deployment

1. Run:
   ```bash
   kubectl get pods -n=tfs
   ```

2. If not running, execute the following:

   ```bash
   cd tfs-hackfest7
   source my_deploy.sh
   ./deploy/all.sh
   ```

3. Open [http://localhost:8080/webui/](http://localhost:8080/webui/) in your browser to confirm the Teraflow Web UI is active.

4. Load the topology:
   - File: `network-topology-hackfest.json`

## 7. Start NSC API

1. Navigate to the NSC directory:
   ```bash
   cd nsc-hackfest7
   ```

2. Update the repo:
   ```bash
   git pull
   git branch
   ```

3. If not on the correct branch:
   ```bash
   git checkout hackfest7
   ```

4. Activate the virtual environment:
   ```bash
   source venv/bin/activate
   ```

5. Run the app:
   ```bash
   python3 app.py
   ```

   If it fails:
   ```bash
   pip install -r requirements.txt
   ```

6. Access the NSC API at [http://localhost:8085/nsc](http://localhost:8085/nsc).

## 8. API Testing

- **Create (POST)**: Send a POST request to create an item.
- **Read (GET)**: Send a GET request to retrieve it.
- **Update**: Modify the resource via PUT/PATCH.
- **Delete**: Remove the resource via DELETE.

Use tools like `curl`, `Postman`, or your browser’s REST client extensions to interact with the API.

---

Happy Hacking!
+535 −0
Original line number Original line Diff line number Diff line
{
    "contexts": [
        {
            "context_id": {
                "context_uuid": {
                    "uuid": "admin"
                }
            }
        }
    ],
    "topologies": [
        {
            "topology_id": {
                "context_id": {
                    "context_uuid": {
                        "uuid": "admin"
                    }
                },
                "topology_uuid": {
                    "uuid": "admin"
                }
            }
        }
    ],
    "devices": [
        {
            "device_id": {
                "device_uuid": {
                    "uuid": "1.1.1.1"
                }
            },
            "name": "1.1.1.1",
            "device_type": "emu-packet-router",
            "device_operational_status": 1,
            "device_drivers": [
                0
            ],
            "device_config": {
                "config_rules": [
                    {
                        "action": 1,
                        "custom": {
                            "resource_key": "_connect/address",
                            "resource_value": "127.0.0.1"
                        }
                    },
                    {
                        "action": 1,
                        "custom": {
                            "resource_key": "_connect/port",
                            "resource_value": "0"
                        }
                    },
                    {
                        "action": 1,
                        "custom": {
                            "resource_key": "_connect/settings",
                            "resource_value": {
                                "endpoints": [
                                    {
                                        "uuid": "mgmt",
                                        "name": "mgmt",
                                        "type": "mgmt"
                                    },
                                    {
                                        "uuid": "eth0",
                                        "name": "eth0",
                                        "type": "copper"
                                    },
                                    {
                                        "uuid": "eth1",
                                        "name": "eth1",
                                        "type": "copper"
                                    },
                                    {
                                        "uuid": "eth2",
                                        "name": "eth2",
                                        "type": "copper"
                                    }
                                ]
                            }
                        }
                    }
                ]
            }
        },
        {
            "device_id": {
                "device_uuid": {
                    "uuid": "2.2.2.2"
                }
            },
            "name": "2.2.2.2",
            "device_type": "emu-packet-router",
            "device_operational_status": 1,
            "device_drivers": [
                0
            ],
            "device_config": {
                "config_rules": [
                    {
                        "action": 1,
                        "custom": {
                            "resource_key": "_connect/address",
                            "resource_value": "127.0.0.1"
                        }
                    },
                    {
                        "action": 1,
                        "custom": {
                            "resource_key": "_connect/port",
                            "resource_value": "0"
                        }
                    },
                    {
                        "action": 1,
                        "custom": {
                            "resource_key": "_connect/settings",
                            "resource_value": {
                                "endpoints": [
                                    {
                                        "uuid": "mgmt",
                                        "name": "mgmt",
                                        "type": "mgmt"
                                    },
                                    {
                                        "uuid": "eth0",
                                        "name": "eth0",
                                        "type": "copper"
                                    },
                                    {
                                        "uuid": "eth1",
                                        "name": "eth0",
                                        "type": "copper"
                                    }
                                ]
                            }
                        }
                    }
                ]
            }
        },
        {
            "device_id": {
                "device_uuid": {
                    "uuid": "3.3.3.3"
                }
            },
            "name": "3.3.3.3",
            "device_type": "emu-packet-router",
            "device_operational_status": 1,
            "device_drivers": [
                0
            ],
            "device_config": {
                "config_rules": [
                    {
                        "action": 1,
                        "custom": {
                            "resource_key": "_connect/address",
                            "resource_value": "127.0.0.1"
                        }
                    },
                    {
                        "action": 1,
                        "custom": {
                            "resource_key": "_connect/port",
                            "resource_value": "0"
                        }
                    },
                    {
                        "action": 1,
                        "custom": {
                            "resource_key": "_connect/settings",
                            "resource_value": {
                                "endpoints": [
                                    {
                                        "uuid": "mgmt",
                                        "name": "mgmt",
                                        "type": "mgmt"
                                    },
                                    {
                                        "uuid": "eth0",
                                        "name": "eth0",
                                        "type": "copper"
                                    },
                                    {
                                        "uuid": "eth1",
                                        "name": "eth1",
                                        "type": "copper"
                                    },
                                    {
                                        "uuid": "eth2",
                                        "name": "eth2",
                                        "type": "copper"
                                    }
                                ]
                            }
                        }
                    }
                ]
            }
        },
        {
            "device_id": {
                "device_uuid": {
                    "uuid": "4.4.4.4"
                }
            },
            "name": "4.4.4.4",
            "device_type": "emu-packet-router",
            "device_operational_status": 1,
            "device_drivers": [
                0
            ],
            "device_config": {
                "config_rules": [
                    {
                        "action": 1,
                        "custom": {
                            "resource_key": "_connect/address",
                            "resource_value": "127.0.0.1"
                        }
                    },
                    {
                        "action": 1,
                        "custom": {
                            "resource_key": "_connect/port",
                            "resource_value": "0"
                        }
                    },
                    {
                        "action": 1,
                        "custom": {
                            "resource_key": "_connect/settings",
                            "resource_value": {
                                "endpoints": [
                                    {
                                        "uuid": "mgmt",
                                        "name": "mgmt",
                                        "type": "mgmt"
                                    },
                                    {
                                        "uuid": "eth0",
                                        "name": "eth0",
                                        "type": "copper"
                                    },
                                    {
                                        "uuid": "eth1",
                                        "name": "eth1",
                                        "type": "copper"
                                    }
                                ]
                            }
                        }
                    }
                ]
            }
        }
    ],
    "links": [
        {
            "link_id": {
                "link_uuid": {
                    "uuid": "1.1.1.1-4.4.4.4"
                }
            },
            "name": "1.1.1.1-4.4.4.4",
            "attributes": {
                "total_capacity_gbps": 10,
                "used_capacity_gbps": 0
            },
            "link_endpoint_ids": [
                {
                    "device_id": {
                        "device_uuid": {
                            "uuid": "1.1.1.1"
                        }
                    },
                    "endpoint_uuid": {
                        "uuid": "eth1"
                    }
                },
                {
                    "device_id": {
                        "device_uuid": {
                            "uuid": "4.4.4.4"
                        }
                    },
                    "endpoint_uuid": {
                        "uuid": "eth0"
                    }
                }
            ]
        },
        {
            "link_id": {
                "link_uuid": {
                    "uuid": "4.4.4.4-1.1.1.1"
                }
            },
            "name": "4.4.4.4-1.1.1.1",
            "attributes": {
                "total_capacity_gbps": 10,
                "used_capacity_gbps": 0
            },
            "link_endpoint_ids": [
                {
                    "device_id": {
                        "device_uuid": {
                            "uuid": "4.4.4.4"
                        }
                    },
                    "endpoint_uuid": {
                        "uuid": "eth0"
                    }
                },
                {
                    "device_id": {
                        "device_uuid": {
                            "uuid": "1.1.1.1"
                        }
                    },
                    "endpoint_uuid": {
                        "uuid": "eth1"
                    }
                }
            ]
        },
        {
            "link_id": {
                "link_uuid": {
                    "uuid": "1.1.1.1-2.2.2.2"
                }
            },
            "name": "1.1.1.1-2.2.2.2",
            "attributes": {
                "total_capacity_gbps": 10,
                "used_capacity_gbps": 0
            },
            "link_endpoint_ids": [
                {
                    "device_id": {
                        "device_uuid": {
                            "uuid": "1.1.1.1"
                        }
                    },
                    "endpoint_uuid": {
                        "uuid": "eth0"
                    }
                },
                {
                    "device_id": {
                        "device_uuid": {
                            "uuid": "2.2.2.2"
                        }
                    },
                    "endpoint_uuid": {
                        "uuid": "eth0"
                    }
                }
            ]
        },
        {
            "link_id": {
                "link_uuid": {
                    "uuid": "2.2.2.2-1.1.1.1"
                }
            },
            "name": "2.2.2.2-1.1.1.1",
            "attributes": {
                "total_capacity_gbps": 10,
                "used_capacity_gbps": 0
            },
            "link_endpoint_ids": [
                {
                    "device_id": {
                        "device_uuid": {
                            "uuid": "2.2.2.2"
                        }
                    },
                    "endpoint_uuid": {
                        "uuid": "eth0"
                    }
                },
                {
                    "device_id": {
                        "device_uuid": {
                            "uuid": "1.1.1.1"
                        }
                    },
                    "endpoint_uuid": {
                        "uuid": "eth0"
                    }
                }
            ]
        },
        {
            "link_id": {
                "link_uuid": {
                    "uuid": "2.2.2.2-3.3.3.3"
                }
            },
            "name": "2.2.2.2-3.3.3.3",
            "attributes": {
                "total_capacity_gbps": 10,
                "used_capacity_gbps": 0
            },
            "link_endpoint_ids": [
                {
                    "device_id": {
                        "device_uuid": {
                            "uuid": "2.2.2.2"
                        }
                    },
                    "endpoint_uuid": {
                        "uuid": "eth1"
                    }
                },
                {
                    "device_id": {
                        "device_uuid": {
                            "uuid": "3.3.3.3"
                        }
                    },
                    "endpoint_uuid": {
                        "uuid": "eth0"
                    }
                }
            ]
        },
        {
            "link_id": {
                "link_uuid": {
                    "uuid": "3.3.3.3-2.2.2.2"
                }
            },
            "name": "3.3.3.3-2.2.2.2",
            "attributes": {
                "total_capacity_gbps": 10,
                "used_capacity_gbps": 0
            },
            "link_endpoint_ids": [
                {
                    "device_id": {
                        "device_uuid": {
                            "uuid": "3.3.3.3"
                        }
                    },
                    "endpoint_uuid": {
                        "uuid": "eth0"
                    }
                },
                {
                    "device_id": {
                        "device_uuid": {
                            "uuid": "2.2.2.2"
                        }
                    },
                    "endpoint_uuid": {
                        "uuid": "eth1"
                    }
                }
            ]
        },
        {
            "link_id": {
                "link_uuid": {
                    "uuid": "3.3.3.3-4.4.4.4"
                }
            },
            "name": "3.3.3.3-4.4.4.4",
            "attributes": {
                "total_capacity_gbps": 10,
                "used_capacity_gbps": 0
            },
            "link_endpoint_ids": [
                {
                    "device_id": {
                        "device_uuid": {
                            "uuid": "3.3.3.3"
                        }
                    },
                    "endpoint_uuid": {
                        "uuid": "eth1"
                    }
                },
                {
                    "device_id": {
                        "device_uuid": {
                            "uuid": "4.4.4.4"
                        }
                    },
                    "endpoint_uuid": {
                        "uuid": "eth1"
                    }
                }
            ]
        },
        {
            "link_id": {
                "link_uuid": {
                    "uuid": "4.4.4.4-3.3.3.3"
                }
            },
            "name": "4.4.4.4-3.3.3.3",
            "attributes": {
                "total_capacity_gbps": 10,
                "used_capacity_gbps": 0
            },
            "link_endpoint_ids": [
                {
                    "device_id": {
                        "device_uuid": {
                            "uuid": "4.4.4.4"
                        }
                    },
                    "endpoint_uuid": {
                        "uuid": "eth1"
                    }
                },
                {
                    "device_id": {
                        "device_uuid": {
                            "uuid": "3.3.3.3"
                        }
                    },
                    "endpoint_uuid": {
                        "uuid": "eth1"
                    }
                }
            ]
        }
    ]
}
 No newline at end of file
+158 −0

File added.

Preview size limit exceeded, changes collapsed.