Jake Hillion
0200a21db4
- Structure built - Proxmox bridge and VM creation Todo: - Proxmox VM networking - SSH
124 lines
2.8 KiB
Plaintext
124 lines
2.8 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"import os\n",
|
|
"import ipaddress\n",
|
|
"\n",
|
|
"import runners\n",
|
|
"from structure import Bridge\n",
|
|
"from structure import SpeedTestServer, RemoteServer, LocalServer\n",
|
|
"from structure import Interface, IpMethod\n",
|
|
"\n",
|
|
"%load_ext dotenv\n",
|
|
"%dotenv"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"outputs": [],
|
|
"source": [
|
|
"runner = runners.ProxmoxRunner(\n",
|
|
" host=os.getenv('PROXMOX_HOST'),\n",
|
|
" node=os.getenv('PROXMOX_NODE'),\n",
|
|
" user=os.getenv('PROXMOX_USER'),\n",
|
|
" token_name=os.getenv('PROXMOX_TOKEN_NAME'),\n",
|
|
" token_value=os.getenv('PROXMOX_TOKEN_VALUE'),\n",
|
|
"\n",
|
|
" template_id=9000,\n",
|
|
" initial_vm_id=21002,\n",
|
|
"\n",
|
|
" internet_bridge='vmbr2',\n",
|
|
"\n",
|
|
" management_bridge='vmbr4',\n",
|
|
" management_initial_ip=ipaddress.ip_address('10.21.12.2'),\n",
|
|
")"
|
|
],
|
|
"metadata": {
|
|
"collapsed": false,
|
|
"pycharm": {
|
|
"name": "#%%\n"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 5,
|
|
"outputs": [],
|
|
"source": [
|
|
"g_st = SpeedTestServer([Interface(IpMethod.Auto4)])\n",
|
|
"l_st = SpeedTestServer([Interface(IpMethod.Dhcp4)])\n",
|
|
"\n",
|
|
"rs = RemoteServer([Interface(IpMethod.Auto4)])\n",
|
|
"ls = LocalServer([\n",
|
|
" Interface(IpMethod.Auto4, limit=1),\n",
|
|
" Interface(IpMethod.Auto4, limit=1),\n",
|
|
"], l_st)\n",
|
|
"\n",
|
|
"top_level_bridge = Bridge(*[\n",
|
|
" g_st.get_interfaces()[0],\n",
|
|
" rs.get_interfaces()[0],\n",
|
|
" *ls.get_interfaces()[0:2],\n",
|
|
"])\n",
|
|
"runner.build(top_level_bridge)\n",
|
|
"\n",
|
|
"# Test from the client to the global network via the proxy\n",
|
|
"g_st.server()\n",
|
|
"l_st.client(rs.get_interfaces()[0])\n",
|
|
"\n",
|
|
"# Test from the global network to the client via the proxy\n",
|
|
"g_st.server()\n",
|
|
"l_st.client(rs.get_interfaces()[0])\n",
|
|
"\n",
|
|
"# Clean up\n",
|
|
"runner.teardown()"
|
|
],
|
|
"metadata": {
|
|
"collapsed": false,
|
|
"pycharm": {
|
|
"name": "#%%\n"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"outputs": [],
|
|
"source": [],
|
|
"metadata": {
|
|
"collapsed": false,
|
|
"pycharm": {
|
|
"name": "#%%\n"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 2
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython2",
|
|
"version": "2.7.6"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 0
|
|
} |