├── .editorconfig ├── .gitignore ├── .rubocop.yml ├── .rubocop_todo.yml ├── CHANGELOG.md ├── COPYING ├── COPYING.LESSER ├── Jenkinsfile ├── Makefile ├── README.md ├── ci ├── cache_functions.sh ├── ci.el6.third-party │ ├── Dockerfile │ ├── Jenkinsfile │ ├── build.sh │ ├── build_packages_third_party.sh │ └── packages.d │ │ ├── openvnet-openvswitch │ │ ├── rpmbuild.sh │ │ └── versions │ │ └── openvnet-zeromq4 │ │ ├── openvnet-zeromq4.spec │ │ └── rpmbuild.sh ├── ci.el6 │ ├── integration_test │ │ ├── Dockerfile │ │ ├── build-cache.list │ │ ├── build_and_run_in_docker.sh │ │ ├── multibox │ │ │ ├── 192.168.2.91 │ │ │ │ ├── build.sh │ │ │ │ ├── destroy.sh │ │ │ │ ├── guestroot │ │ │ │ │ └── etc │ │ │ │ │ │ ├── openvnet │ │ │ │ │ │ ├── common.conf │ │ │ │ │ │ ├── vna.conf │ │ │ │ │ │ ├── vnmgr.conf │ │ │ │ │ │ └── webapi.conf │ │ │ │ │ │ └── sysconfig │ │ │ │ │ │ ├── network │ │ │ │ │ │ └── network-scripts │ │ │ │ │ │ ├── ifcfg-br0 │ │ │ │ │ │ ├── ifcfg-br1 │ │ │ │ │ │ ├── ifcfg-eth0 │ │ │ │ │ │ ├── ifcfg-eth1 │ │ │ │ │ │ └── route-br0 │ │ │ │ ├── kill.sh │ │ │ │ ├── login.sh │ │ │ │ └── vmspec.conf │ │ │ ├── 192.168.2.92 │ │ │ │ ├── build.sh │ │ │ │ ├── destroy.sh │ │ │ │ ├── guestroot │ │ │ │ │ └── etc │ │ │ │ │ │ ├── openvnet │ │ │ │ │ │ ├── common.conf │ │ │ │ │ │ └── vna.conf │ │ │ │ │ │ └── sysconfig │ │ │ │ │ │ ├── network │ │ │ │ │ │ └── network-scripts │ │ │ │ │ │ ├── ifcfg-br0 │ │ │ │ │ │ ├── ifcfg-br1 │ │ │ │ │ │ ├── ifcfg-eth0 │ │ │ │ │ │ ├── ifcfg-eth1 │ │ │ │ │ │ ├── ifcfg-eth2 │ │ │ │ │ │ └── route-br0 │ │ │ │ ├── kill.sh │ │ │ │ ├── login.sh │ │ │ │ └── vmspec.conf │ │ │ ├── 192.168.2.93 │ │ │ │ ├── build.sh │ │ │ │ ├── destroy.sh │ │ │ │ ├── guestroot │ │ │ │ │ └── etc │ │ │ │ │ │ ├── openvnet │ │ │ │ │ │ ├── common.conf │ │ │ │ │ │ └── vna.conf │ │ │ │ │ │ └── sysconfig │ │ │ │ │ │ ├── network │ │ │ │ │ │ └── network-scripts │ │ │ │ │ │ ├── ifcfg-br0 │ │ │ │ │ │ ├── ifcfg-br1 │ │ │ │ │ │ ├── ifcfg-eth0 │ │ │ │ │ │ ├── ifcfg-eth1 │ │ │ │ │ │ └── route-br0 │ │ │ │ ├── kill.sh │ │ │ │ ├── login.sh │ │ │ │ └── vmspec.conf │ │ │ ├── 192.168.2.95 │ │ │ │ ├── build.sh │ │ │ │ ├── destroy.sh │ │ │ │ ├── guestroot │ │ │ │ │ └── etc │ │ │ │ │ │ └── sysconfig │ │ │ │ │ │ ├── network │ │ │ │ │ │ └── network-scripts │ │ │ │ │ │ ├── ifcfg-eth0 │ │ │ │ │ │ ├── ifcfg-eth1 │ │ │ │ │ │ └── ifcfg-eth2 │ │ │ │ ├── kill.sh │ │ │ │ ├── login.sh │ │ │ │ └── vmspec.conf │ │ │ ├── 192.168.2.96 │ │ │ │ ├── build.sh │ │ │ │ ├── destroy.sh │ │ │ │ ├── guestroot │ │ │ │ │ └── etc │ │ │ │ │ │ ├── openvnet │ │ │ │ │ │ ├── common.conf │ │ │ │ │ │ └── vna.conf │ │ │ │ │ │ └── sysconfig │ │ │ │ │ │ ├── network │ │ │ │ │ │ └── network-scripts │ │ │ │ │ │ ├── ifcfg-br0 │ │ │ │ │ │ ├── ifcfg-br1 │ │ │ │ │ │ ├── ifcfg-eth0 │ │ │ │ │ │ ├── ifcfg-eth1 │ │ │ │ │ │ ├── ifcfg-eth2 │ │ │ │ │ │ └── route-br0 │ │ │ │ ├── kill.sh │ │ │ │ ├── login.sh │ │ │ │ └── vmspec.conf │ │ │ ├── base │ │ │ │ ├── build.sh │ │ │ │ ├── destroy.sh │ │ │ │ ├── guestroot │ │ │ │ │ └── etc │ │ │ │ │ │ ├── sysconfig │ │ │ │ │ │ ├── network │ │ │ │ │ │ └── network-scripts │ │ │ │ │ │ │ └── ifcfg-eth0 │ │ │ │ │ │ └── yum.repos.d │ │ │ │ │ │ └── CentOS-Base.repo │ │ │ │ ├── kill.sh │ │ │ │ ├── login.sh │ │ │ │ └── vmspec.conf │ │ │ ├── build.sh │ │ │ ├── config.source │ │ │ ├── destroy.sh │ │ │ ├── external_libraries │ │ │ │ ├── README.md │ │ │ │ ├── bashsteps │ │ │ │ │ ├── README.md │ │ │ │ │ ├── bashctrl.sh │ │ │ │ │ ├── doc │ │ │ │ │ │ └── intro-to-core.md │ │ │ │ │ ├── examples │ │ │ │ │ │ ├── new │ │ │ │ │ │ │ ├── new-duped-substep.sh │ │ │ │ │ │ │ ├── simple-defaults-for-bashsteps.source │ │ │ │ │ │ │ └── with-temporary-state.sh │ │ │ │ │ │ └── old │ │ │ │ │ │ │ ├── duped-substep.sh │ │ │ │ │ │ │ └── simple-defaults-for-bashsteps.source │ │ │ │ │ ├── ind-steps │ │ │ │ │ │ └── kvmsteps │ │ │ │ │ │ │ ├── kvm-setup.sh │ │ │ │ │ │ │ ├── monitor-process.sh │ │ │ │ │ │ │ ├── simple-defaults-for-bashsteps.source │ │ │ │ │ │ │ └── vmdir-scripts │ │ │ │ │ │ │ ├── kvm-boot.sh │ │ │ │ │ │ │ ├── kvm-kill.sh │ │ │ │ │ │ │ ├── kvm-shutdown-via-ssh.sh │ │ │ │ │ │ │ └── ssh-to-kvm.sh │ │ │ │ │ └── simple-defaults-for-bashsteps.source │ │ │ │ └── mount-partition │ │ │ │ │ └── mount-partition.sh │ │ │ ├── ind-steps │ │ │ │ ├── common.source │ │ │ │ ├── step-box │ │ │ │ │ ├── boot.sh │ │ │ │ │ ├── common.source │ │ │ │ │ ├── init.sh │ │ │ │ │ └── postconfigure.sh │ │ │ │ ├── step-buildenv │ │ │ │ │ ├── boot.sh │ │ │ │ │ ├── common.source │ │ │ │ │ ├── init.sh │ │ │ │ │ ├── preconfigure.sh │ │ │ │ │ └── provide.sh │ │ │ │ ├── step-epel │ │ │ │ │ └── install.sh │ │ │ │ ├── step-lxc │ │ │ │ │ ├── common.source │ │ │ │ │ ├── install.sh │ │ │ │ │ └── postconfigure.sh │ │ │ │ ├── step-mysql │ │ │ │ │ ├── install.sh │ │ │ │ │ └── provide.sh │ │ │ │ ├── step-nettools │ │ │ │ │ └── install.sh │ │ │ │ ├── step-openvnet │ │ │ │ │ └── install.sh │ │ │ │ ├── step-openvswitch │ │ │ │ │ └── install.sh │ │ │ │ ├── step-redis │ │ │ │ │ ├── install.sh │ │ │ │ │ ├── preconfigure.sh │ │ │ │ │ └── provide.sh │ │ │ │ ├── step-sclo-ruby │ │ │ │ │ └── install.sh │ │ │ │ └── step-ssh │ │ │ │ │ ├── boot.sh │ │ │ │ │ ├── common.source │ │ │ │ │ └── install.sh │ │ │ ├── kill.sh │ │ │ └── login.sh │ │ └── run_tests.sh │ └── rspec_rpmbuild │ │ ├── Dockerfile │ │ ├── build-cache.list │ │ ├── build.sh │ │ ├── build_packages_vnet.sh │ │ ├── conf_files │ │ ├── etc │ │ │ ├── default │ │ │ │ ├── openvnet │ │ │ │ ├── vnet-redis-monitor │ │ │ │ ├── vnet-vna │ │ │ │ ├── vnet-vnmgr │ │ │ │ └── vnet-webapi │ │ │ ├── init │ │ │ │ ├── vnet-redis-monitor.conf │ │ │ │ ├── vnet-vna.conf │ │ │ │ ├── vnet-vnmgr.conf │ │ │ │ └── vnet-webapi.conf │ │ │ └── openvnet │ │ │ │ ├── common.conf │ │ │ │ ├── vna.conf │ │ │ │ ├── vnctl-ruby │ │ │ │ ├── vnctl.conf │ │ │ │ ├── vnmgr.conf │ │ │ │ └── webapi.conf │ │ └── usr │ │ │ └── bin │ │ │ └── vnctl │ │ ├── fastestmirror.conf │ │ ├── packages.d │ │ └── vnet │ │ │ └── openvnet.spec │ │ └── yum.repo │ │ └── dev.repo ├── ci.el7.third-party │ ├── Dockerfile │ ├── Jenkinsfile │ ├── build.sh │ ├── build_packages_third_party.sh │ └── packages.d │ │ └── openvnet-openvswitch │ │ ├── rpmbuild.sh │ │ └── versions ├── ci.el7 │ ├── integration_test │ │ ├── Dockerfile │ │ ├── build-cache.list │ │ ├── build_and_run_in_docker.sh │ │ ├── multibox │ │ │ ├── 192.168.2.91 │ │ │ │ ├── build.sh │ │ │ │ ├── destroy.sh │ │ │ │ ├── guestroot │ │ │ │ │ └── etc │ │ │ │ │ │ ├── default │ │ │ │ │ │ ├── openvnet │ │ │ │ │ │ ├── vnet-vna │ │ │ │ │ │ ├── vnet-vnmgr │ │ │ │ │ │ └── vnet-webapi │ │ │ │ │ │ ├── openvnet │ │ │ │ │ │ ├── common.conf │ │ │ │ │ │ ├── vna.conf │ │ │ │ │ │ ├── vnmgr.conf │ │ │ │ │ │ └── webapi.conf │ │ │ │ │ │ ├── redis.conf │ │ │ │ │ │ └── sysconfig │ │ │ │ │ │ ├── network │ │ │ │ │ │ └── network-scripts │ │ │ │ │ │ ├── ifcfg-br0 │ │ │ │ │ │ ├── ifcfg-br1 │ │ │ │ │ │ ├── ifcfg-eth0 │ │ │ │ │ │ ├── ifcfg-eth1 │ │ │ │ │ │ └── route-br0 │ │ │ │ ├── kill.sh │ │ │ │ ├── login.sh │ │ │ │ ├── run_cmd.sh │ │ │ │ └── vmspec.conf │ │ │ ├── 192.168.2.92 │ │ │ │ ├── build.sh │ │ │ │ ├── destroy.sh │ │ │ │ ├── guestroot │ │ │ │ │ └── etc │ │ │ │ │ │ ├── default │ │ │ │ │ │ ├── openvnet │ │ │ │ │ │ └── vnet-vna │ │ │ │ │ │ ├── openvnet │ │ │ │ │ │ ├── common.conf │ │ │ │ │ │ └── vna.conf │ │ │ │ │ │ └── sysconfig │ │ │ │ │ │ ├── network │ │ │ │ │ │ └── network-scripts │ │ │ │ │ │ ├── ifcfg-br0 │ │ │ │ │ │ ├── ifcfg-br1 │ │ │ │ │ │ ├── ifcfg-eth0 │ │ │ │ │ │ ├── ifcfg-eth1 │ │ │ │ │ │ ├── ifcfg-eth2 │ │ │ │ │ │ └── route-br0 │ │ │ │ ├── kill.sh │ │ │ │ ├── login.sh │ │ │ │ ├── run_cmd.sh │ │ │ │ └── vmspec.conf │ │ │ ├── 192.168.2.93 │ │ │ │ ├── build.sh │ │ │ │ ├── destroy.sh │ │ │ │ ├── guestroot │ │ │ │ │ └── etc │ │ │ │ │ │ ├── default │ │ │ │ │ │ ├── openvnet │ │ │ │ │ │ └── vnet-vna │ │ │ │ │ │ ├── openvnet │ │ │ │ │ │ ├── common.conf │ │ │ │ │ │ └── vna.conf │ │ │ │ │ │ └── sysconfig │ │ │ │ │ │ ├── network │ │ │ │ │ │ └── network-scripts │ │ │ │ │ │ ├── ifcfg-br0 │ │ │ │ │ │ ├── ifcfg-br1 │ │ │ │ │ │ ├── ifcfg-eth0 │ │ │ │ │ │ ├── ifcfg-eth1 │ │ │ │ │ │ └── route-br0 │ │ │ │ ├── kill.sh │ │ │ │ ├── login.sh │ │ │ │ ├── run_cmd.sh │ │ │ │ └── vmspec.conf │ │ │ ├── 192.168.2.95 │ │ │ │ ├── build.sh │ │ │ │ ├── destroy.sh │ │ │ │ ├── guestroot │ │ │ │ │ └── etc │ │ │ │ │ │ └── sysconfig │ │ │ │ │ │ ├── network │ │ │ │ │ │ └── network-scripts │ │ │ │ │ │ ├── ifcfg-eth0 │ │ │ │ │ │ ├── ifcfg-eth1 │ │ │ │ │ │ └── ifcfg-eth2 │ │ │ │ ├── kill.sh │ │ │ │ ├── login.sh │ │ │ │ ├── run_cmd.sh │ │ │ │ └── vmspec.conf │ │ │ ├── 192.168.2.96 │ │ │ │ ├── build.sh │ │ │ │ ├── destroy.sh │ │ │ │ ├── guestroot │ │ │ │ │ └── etc │ │ │ │ │ │ ├── default │ │ │ │ │ │ ├── openvnet │ │ │ │ │ │ └── vnet-vna │ │ │ │ │ │ ├── openvnet │ │ │ │ │ │ ├── common.conf │ │ │ │ │ │ └── vna.conf │ │ │ │ │ │ └── sysconfig │ │ │ │ │ │ ├── network │ │ │ │ │ │ └── network-scripts │ │ │ │ │ │ ├── ifcfg-br0 │ │ │ │ │ │ ├── ifcfg-br1 │ │ │ │ │ │ ├── ifcfg-eth0 │ │ │ │ │ │ ├── ifcfg-eth1 │ │ │ │ │ │ ├── ifcfg-eth2 │ │ │ │ │ │ └── route-br0 │ │ │ │ ├── kill.sh │ │ │ │ ├── login.sh │ │ │ │ ├── run_cmd.sh │ │ │ │ └── vmspec.conf │ │ │ ├── base │ │ │ │ ├── build.sh │ │ │ │ ├── destroy.sh │ │ │ │ ├── guestroot │ │ │ │ │ └── etc │ │ │ │ │ │ ├── sysconfig │ │ │ │ │ │ ├── network │ │ │ │ │ │ └── network-scripts │ │ │ │ │ │ │ └── ifcfg-eth0 │ │ │ │ │ │ └── yum.repos.d │ │ │ │ │ │ └── CentOS-Base.repo │ │ │ │ ├── kill.sh │ │ │ │ ├── login.sh │ │ │ │ └── vmspec.conf │ │ │ ├── build.sh │ │ │ ├── config.source │ │ │ ├── destroy.sh │ │ │ ├── external_libraries │ │ │ │ ├── README.md │ │ │ │ ├── bashsteps │ │ │ │ │ ├── README.md │ │ │ │ │ ├── bashctrl.sh │ │ │ │ │ ├── doc │ │ │ │ │ │ └── intro-to-core.md │ │ │ │ │ ├── examples │ │ │ │ │ │ ├── new │ │ │ │ │ │ │ ├── new-duped-substep.sh │ │ │ │ │ │ │ ├── simple-defaults-for-bashsteps.source │ │ │ │ │ │ │ └── with-temporary-state.sh │ │ │ │ │ │ └── old │ │ │ │ │ │ │ ├── duped-substep.sh │ │ │ │ │ │ │ └── simple-defaults-for-bashsteps.source │ │ │ │ │ ├── ind-steps │ │ │ │ │ │ └── kvmsteps │ │ │ │ │ │ │ ├── kvm-setup.sh │ │ │ │ │ │ │ ├── monitor-process.sh │ │ │ │ │ │ │ ├── simple-defaults-for-bashsteps.source │ │ │ │ │ │ │ └── vmdir-scripts │ │ │ │ │ │ │ ├── kvm-boot.sh │ │ │ │ │ │ │ ├── kvm-kill.sh │ │ │ │ │ │ │ ├── kvm-shutdown-via-ssh.sh │ │ │ │ │ │ │ └── ssh-to-kvm.sh │ │ │ │ │ └── simple-defaults-for-bashsteps.source │ │ │ │ └── mount-partition │ │ │ │ │ └── mount-partition.sh │ │ │ ├── ind-steps │ │ │ │ ├── common.source │ │ │ │ ├── step-box │ │ │ │ │ ├── boot.sh │ │ │ │ │ ├── common.source │ │ │ │ │ ├── init.sh │ │ │ │ │ └── postconfigure.sh │ │ │ │ ├── step-buildenv │ │ │ │ │ ├── boot.sh │ │ │ │ │ ├── common.source │ │ │ │ │ ├── init.sh │ │ │ │ │ ├── preconfigure.sh │ │ │ │ │ └── provide.sh │ │ │ │ ├── step-epel │ │ │ │ │ └── install.sh │ │ │ │ ├── step-lxc │ │ │ │ │ ├── common.source │ │ │ │ │ ├── install.sh │ │ │ │ │ ├── postconfigure.sh │ │ │ │ │ └── provide.sh │ │ │ │ ├── step-mysql │ │ │ │ │ ├── install.sh │ │ │ │ │ ├── preconfigure.sh │ │ │ │ │ └── provide.sh │ │ │ │ ├── step-nettools │ │ │ │ │ └── install.sh │ │ │ │ ├── step-openvnet │ │ │ │ │ └── install.sh │ │ │ │ ├── step-openvswitch │ │ │ │ │ └── install.sh │ │ │ │ ├── step-redis │ │ │ │ │ ├── install.sh │ │ │ │ │ └── provide.sh │ │ │ │ ├── step-sclo-ruby │ │ │ │ │ └── install.sh │ │ │ │ └── step-ssh │ │ │ │ │ ├── boot.sh │ │ │ │ │ ├── common.source │ │ │ │ │ └── install.sh │ │ │ ├── kill.sh │ │ │ ├── login.sh │ │ │ └── run_cmd.sh │ │ └── run_tests.sh │ └── rspec_rpmbuild │ │ ├── Dockerfile │ │ ├── build-cache.list │ │ ├── build.sh │ │ ├── build_packages_vnet.sh │ │ ├── conf_files │ │ ├── etc │ │ │ ├── openvnet │ │ │ │ ├── common.conf │ │ │ │ ├── vna.conf │ │ │ │ ├── vnctl-ruby │ │ │ │ ├── vnctl.conf │ │ │ │ ├── vnmgr.conf │ │ │ │ └── webapi.conf │ │ │ ├── sysconfig │ │ │ │ └── openvnet │ │ │ └── systemd │ │ │ │ └── system │ │ │ │ └── vnet-webapi.service.d │ │ │ │ └── env.conf │ │ └── usr │ │ │ ├── bin │ │ │ └── vnctl │ │ │ └── lib │ │ │ └── systemd │ │ │ └── system │ │ │ ├── vnet-redis-monitor.service │ │ │ ├── vnet-vna.service │ │ │ ├── vnet-vnmgr.service │ │ │ └── vnet-webapi.service │ │ ├── fastestmirror.conf │ │ ├── packages.d │ │ ├── third_party │ │ │ └── openvnet-openvswitch │ │ │ │ ├── el6.versions │ │ │ │ ├── el7.versions │ │ │ │ └── rpmbuild.sh │ │ └── vnet │ │ │ └── openvnet.spec │ │ └── yum.repo │ │ └── dev.repo ├── garbage_collection │ ├── Jenkinsfile │ ├── cache_cleanups │ │ └── cache_garbage_collection.sh │ ├── docker_cleanups │ │ └── docker_garbage_collection.sh │ ├── garbage_collection_misc.sh │ ├── prune_branches.sh │ └── repo_cleanups │ │ └── rpm_garbage_collection.sh └── gen-dev-build-tag.sh ├── client ├── ruby │ ├── README.md │ ├── lib │ │ ├── vnet_api_client.rb │ │ └── vnet_api_client │ │ │ ├── api_resource.rb │ │ │ ├── api_resources.rb │ │ │ └── response_format.rb │ └── vnet_api_client.gemspec └── vnctl │ ├── .gitignore │ ├── Gemfile │ ├── Gemfile.lock │ ├── bin │ └── vnctl │ └── lib │ ├── vnctl.rb │ └── vnctl │ ├── cli │ ├── base.rb │ ├── datapath.rb │ ├── dns_service.rb │ ├── filter.rb │ ├── interface.rb │ ├── ip_lease.rb │ ├── ip_lease_container.rb │ ├── ip_range_group.rb │ ├── ip_retention_container.rb │ ├── lease_policy.rb │ ├── mac_lease.rb │ ├── mac_range_group.rb │ ├── network.rb │ ├── network_service.rb │ ├── root.rb │ ├── route.rb │ ├── route_link.rb │ ├── segment.rb │ ├── topology.rb │ └── translation.rb │ ├── configuration │ └── vnctl.rb │ └── webapi.rb ├── deployment ├── conf_files │ ├── etc │ │ ├── default │ │ │ ├── openvnet │ │ │ ├── vnet-vna │ │ │ ├── vnet-vnmgr │ │ │ └── vnet-webapi │ │ ├── init │ │ │ ├── vnet-vna.conf │ │ │ ├── vnet-vnmgr.conf │ │ │ └── vnet-webapi.conf │ │ └── openvnet │ │ │ ├── common.conf │ │ │ ├── vna.conf │ │ │ ├── vnctl.conf │ │ │ ├── vnmgr.conf │ │ │ └── webapi.conf │ └── usr │ │ └── bin │ │ └── vnctl └── yum_repositories │ ├── development │ ├── openvnet-third-party.repo │ └── openvnet.repo │ └── stable │ ├── openvnet-third-party.repo │ └── openvnet.repo ├── docs ├── .gitignore ├── README.md ├── content │ ├── advanced-features │ │ └── filters.md │ ├── community.md │ ├── concept.md │ ├── configuration-files │ │ ├── common.md │ │ ├── vna.md │ │ ├── vnctl.md │ │ ├── vnmgr.md │ │ └── webapi.md │ ├── creating-virtual-networks │ │ ├── img │ │ │ ├── images.odg │ │ │ ├── single-network-dhcp.png │ │ │ ├── single-network.png │ │ │ ├── two-networks-router.png │ │ │ └── two-networks.png │ │ ├── single-network-dhcp.md │ │ ├── single-network.md │ │ ├── two-networks-router.md │ │ └── two-networks.md │ ├── custom.css │ ├── debugging │ │ ├── integration-test.md │ │ ├── troubleshooting.md │ │ └── vnflows-monitor.md │ ├── favicon.png │ ├── features.md │ ├── img │ │ ├── OpenVNet_logo_single.png │ │ ├── all-in-one-host.png │ │ ├── axsh-logo_fullcolor.png │ │ ├── concept_1.png │ │ ├── concept_2.png │ │ ├── images.odg │ │ └── installation-environment.png │ ├── index.md │ ├── installation.md │ ├── jargon-dictionary.md │ ├── upgrade.md │ └── vnctl │ │ ├── datapaths.md │ │ ├── filters.md │ │ ├── interfaces.md │ │ └── networks.md └── mkdocs.yml ├── integration_test ├── .gitignore ├── Gemfile ├── Gemfile.lock ├── README.md ├── bin │ ├── dev-spec │ ├── itest-spec │ └── vnspec ├── config │ ├── base.yml │ ├── default.yml │ ├── dev.yml │ └── itest.yml ├── dataset │ ├── base.yml │ ├── base_dp.yml │ ├── base_topology.yml │ ├── event.yml │ ├── event_nw_tp.yml │ ├── event_seg_tp.yml │ ├── event_tp.yml │ ├── filter.yml │ ├── lease_policy.yml │ ├── promiscuous_nw.yml │ ├── promiscuous_seg_of.yml │ ├── promiscuous_seg_ovs.yml │ ├── router_p2v.yml │ ├── router_v2v.yml │ ├── router_v2v_tp.yml │ ├── service.yml │ ├── simple_nw.yml │ ├── simple_nw_tp.yml │ ├── simple_seg.yml │ ├── simple_seg_tp.yml │ ├── wanedge.yml │ └── wanedge_tp.yml ├── lib │ ├── ext │ │ ├── erb.rb │ │ └── hash.rb │ ├── vnspec.rb │ └── vnspec │ │ ├── .rspec │ │ ├── api.rb │ │ ├── api │ │ ├── base.rb │ │ ├── faraday.rb │ │ └── vnctl.rb │ │ ├── config.rb │ │ ├── dataset.rb │ │ ├── invoker.rb │ │ ├── legacy.rb │ │ ├── logger.rb │ │ ├── models.rb │ │ ├── spec.rb │ │ ├── spec │ │ ├── event_nw_tp_spec.rb │ │ ├── event_seg_tp_spec.rb │ │ ├── event_spec.rb │ │ ├── event_tp_spec.rb │ │ ├── filter_spec.rb │ │ ├── lease_policy_spec.rb │ │ ├── promiscuous_nw_spec.rb │ │ ├── promiscuous_seg_of_spec.rb │ │ ├── promiscuous_seg_ovs_spec.rb │ │ ├── router_p2v_spec.rb │ │ ├── router_v2v_spec.rb │ │ ├── router_v2v_tp_spec.rb │ │ ├── service_spec.rb │ │ ├── shared_examples │ │ │ ├── promiscuous.rb │ │ │ ├── router.rb │ │ │ ├── simple.rb │ │ │ └── wanedge.rb │ │ ├── simple_nw_spec.rb │ │ ├── simple_nw_tp_spec.rb │ │ ├── simple_seg_spec.rb │ │ ├── simple_seg_tp_spec.rb │ │ ├── spec_helper.rb │ │ ├── support │ │ │ ├── legacy.rb │ │ │ └── vm.rb │ │ ├── wanedge_spec.rb │ │ └── wanedge_tp_spec.rb │ │ ├── ssh.rb │ │ ├── vm.rb │ │ └── vnet.rb └── log │ └── .gitkeep └── vnet ├── .gitignore ├── .rspec ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── README.md ├── Rakefile ├── bin ├── console ├── redis-monitor ├── vna ├── vnflows-monitor └── vnmgr ├── db └── migrations │ ├── 0001_origin.rb │ ├── 0002_services.rb │ ├── 0003_set_is_deleted_default_value.rb │ ├── 0004_active_items.rb │ ├── 0005_mac_leases.rb │ ├── 0006_filters.rb │ ├── 0007_mode_only.rb │ ├── 0008_dp_nwrl_not_null.rb │ ├── 0009_topology.rb │ ├── 0010_segment.rb │ ├── 0011_interface_assoc.rb │ ├── 0012_remove_vnetedge.rb │ ├── 0013_learning_flows.rb │ ├── 0014_topology_layer.rb │ ├── 0015_cleanup.rb │ ├── 0016_remove_sg.rb │ ├── 0017_filter_static.rb │ └── 0018_topology_lease.rb ├── lib ├── ext │ └── kernel.rb ├── sequel │ └── plugins │ │ ├── ip_address.rb │ │ ├── mac_address.rb │ │ ├── mac_address_no_segment.rb │ │ └── paranoia_is_deleted.rb ├── sinatra │ └── vnet_api_setup.rb ├── vnet.rb └── vnet │ ├── api_direct.rb │ ├── api_rpc.rb │ ├── configurations │ ├── common.rb │ ├── vna.rb │ ├── vnmgr.rb │ └── webapi.rb │ ├── constants │ ├── active_port.rb │ ├── filter.rb │ ├── filter_static.rb │ ├── interface.rb │ ├── lease_policy.rb │ ├── mac_address_prefix.rb │ ├── network.rb │ ├── network_service.rb │ ├── openflow.rb │ ├── openflow_flows.rb │ ├── segment.rb │ ├── topology.rb │ ├── translation.rb │ └── vnet_api.rb │ ├── core │ ├── active_interface_manager.rb │ ├── active_interfaces │ │ ├── base.rb │ │ ├── local.rb │ │ └── remote.rb │ ├── active_manager.rb │ ├── active_network_manager.rb │ ├── active_networks │ │ ├── base.rb │ │ ├── local.rb │ │ └── remote.rb │ ├── active_port_manager.rb │ ├── active_ports │ │ ├── base.rb │ │ ├── local.rb │ │ ├── tunnel.rb │ │ └── unknown.rb │ ├── active_route_link_manager.rb │ ├── active_route_links │ │ ├── base.rb │ │ ├── local.rb │ │ └── remote.rb │ ├── active_segment_manager.rb │ ├── active_segments │ │ ├── base.rb │ │ ├── local.rb │ │ └── remote.rb │ ├── address_helpers.rb │ ├── datapath_manager.rb │ ├── datapaths │ │ ├── base.rb │ │ ├── host.rb │ │ └── remote.rb │ ├── dp_info.rb │ ├── event_helpers.rb │ ├── filter_manager.rb │ ├── filters │ │ ├── base.rb │ │ └── static.rb │ ├── host_datapath_manager.rb │ ├── host_datapaths │ │ └── base.rb │ ├── interface.rb │ ├── interface_manager.rb │ ├── interface_network_manager.rb │ ├── interface_networks │ │ └── base.rb │ ├── interface_port_manager.rb │ ├── interface_ports │ │ └── base.rb │ ├── interface_route_link_manager.rb │ ├── interface_route_links │ │ └── base.rb │ ├── interface_segment_manager.rb │ ├── interface_segments │ │ └── base.rb │ ├── interfaces │ │ ├── base.rb │ │ ├── host.rb │ │ ├── if_base.rb │ │ ├── internal.rb │ │ ├── patch.rb │ │ ├── promiscuous.rb │ │ ├── simulated.rb │ │ └── vif.rb │ ├── items.rb │ ├── manager.rb │ ├── network_manager.rb │ ├── networks │ │ ├── base.rb │ │ ├── internal.rb │ │ ├── physical.rb │ │ └── virtual.rb │ ├── port.rb │ ├── port_manager.rb │ ├── ports │ │ ├── base.rb │ │ ├── host.rb │ │ ├── local.rb │ │ ├── promiscuous.rb │ │ ├── tunnel.rb │ │ └── vif.rb │ ├── route_manager.rb │ ├── router_manager.rb │ ├── routers │ │ ├── base.rb │ │ └── route_link.rb │ ├── routes │ │ └── base.rb │ ├── segment_manager.rb │ ├── segments │ │ ├── base.rb │ │ └── virtual.rb │ ├── service.rb │ ├── service_manager.rb │ ├── services │ │ ├── base.rb │ │ ├── dhcp.rb │ │ ├── dns.rb │ │ └── router.rb │ ├── translation_manager.rb │ ├── translations │ │ ├── base.rb │ │ └── static_address.rb │ ├── tunnel.rb │ ├── tunnel_manager.rb │ └── tunnels │ │ ├── base.rb │ │ ├── gre.rb │ │ ├── mac2mac.rb │ │ └── unknown.rb │ ├── endpoints │ ├── 1.0 │ │ ├── datapaths.rb │ │ ├── dns_services.rb │ │ ├── filters.rb │ │ ├── helpers.rb │ │ ├── interfaces.rb │ │ ├── ip_lease_containers.rb │ │ ├── ip_leases.rb │ │ ├── ip_range_groups.rb │ │ ├── ip_retention_containers.rb │ │ ├── lease_policies.rb │ │ ├── mac_leases.rb │ │ ├── mac_range_groups.rb │ │ ├── network_services.rb │ │ ├── networks.rb │ │ ├── responses │ │ │ ├── datapath.rb │ │ │ ├── datapath_network.rb │ │ │ ├── datapath_route_link.rb │ │ │ ├── dns_record.rb │ │ │ ├── dns_service.rb │ │ │ ├── filter.rb │ │ │ ├── interface.rb │ │ │ ├── interface_port.rb │ │ │ ├── ip_address.rb │ │ │ ├── ip_lease.rb │ │ │ ├── ip_lease_container.rb │ │ │ ├── ip_range.rb │ │ │ ├── ip_range_group.rb │ │ │ ├── ip_retention.rb │ │ │ ├── ip_retention_container.rb │ │ │ ├── lease_policy.rb │ │ │ ├── mac_address.rb │ │ │ ├── mac_lease.rb │ │ │ ├── mac_range.rb │ │ │ ├── mac_range_group.rb │ │ │ ├── network.rb │ │ │ ├── network_service.rb │ │ │ ├── route.rb │ │ │ ├── route_link.rb │ │ │ ├── segment.rb │ │ │ ├── topology.rb │ │ │ ├── translation.rb │ │ │ └── translation_static_address.rb │ │ ├── route_links.rb │ │ ├── routes.rb │ │ ├── segments.rb │ │ ├── topologies.rb │ │ ├── translations.rb │ │ └── vnet_api.rb │ ├── errors.rb │ └── response_generator.rb │ ├── event.rb │ ├── event │ ├── dispatchable.rb │ ├── event_tasks.rb │ └── notifications.rb │ ├── helpers │ └── ip_address.rb │ ├── initializers │ ├── db.rb │ └── logger.rb │ ├── item_base.rb │ ├── manager.rb │ ├── manager_assocs.rb │ ├── manager_list.rb │ ├── manager_logger.rb │ ├── manager_modules.rb │ ├── manager_query.rb │ ├── manager_watchdog.rb │ ├── model_wrappers │ ├── active_port.rb │ ├── base.rb │ ├── datapath.rb │ ├── dns_record.rb │ ├── dns_service.rb │ ├── filter.rb │ ├── helpers.rb │ ├── interface.rb │ ├── ip_address.rb │ ├── ip_lease.rb │ ├── ip_lease_container.rb │ ├── ip_lease_container_ip_lease.rb │ ├── ip_retention.rb │ ├── ip_retention_container.rb │ ├── lease_policy.rb │ ├── lease_policy_ip_lease_container.rb │ ├── lease_policy_ip_retention_container.rb │ ├── mac_address.rb │ ├── mac_lease.rb │ ├── network.rb │ ├── network_service.rb │ ├── route.rb │ ├── route_link.rb │ ├── topology.rb │ ├── translation.rb │ ├── tunnel.rb │ └── wrappers.rb │ ├── models │ ├── active_interface.rb │ ├── active_network.rb │ ├── active_port.rb │ ├── active_route_link.rb │ ├── active_segment.rb │ ├── base.rb │ ├── base_mode.rb │ ├── base_taggable.rb │ ├── datapath.rb │ ├── datapath_network.rb │ ├── datapath_route_link.rb │ ├── datapath_segment.rb │ ├── dns_record.rb │ ├── dns_service.rb │ ├── filter.rb │ ├── filter_static.rb │ ├── interface.rb │ ├── interface_network.rb │ ├── interface_port.rb │ ├── interface_route_link.rb │ ├── interface_segment.rb │ ├── ip_address.rb │ ├── ip_lease.rb │ ├── ip_lease_container.rb │ ├── ip_lease_container_ip_lease.rb │ ├── ip_range.rb │ ├── ip_range_group.rb │ ├── ip_retention.rb │ ├── ip_retention_container.rb │ ├── lease_policy.rb │ ├── lease_policy_base_interface.rb │ ├── lease_policy_base_network.rb │ ├── lease_policy_ip_lease_container.rb │ ├── lease_policy_ip_retention_container.rb │ ├── mac_address.rb │ ├── mac_lease.rb │ ├── mac_range.rb │ ├── mac_range_group.rb │ ├── network.rb │ ├── network_service.rb │ ├── route.rb │ ├── route_link.rb │ ├── segment.rb │ ├── topology.rb │ ├── topology_datapath.rb │ ├── topology_layer.rb │ ├── topology_mac_range_group.rb │ ├── topology_network.rb │ ├── topology_route_link.rb │ ├── topology_segment.rb │ ├── translation.rb │ ├── translation_static_address.rb │ └── tunnel.rb │ ├── node_api.rb │ ├── node_api │ ├── active_interface.rb │ ├── active_network.rb │ ├── active_port.rb │ ├── active_route_link.rb │ ├── active_segment.rb │ ├── assoc_base.rb │ ├── base.rb │ ├── base_valid_update_fields.rb │ ├── datapath.rb │ ├── datapath_generic.rb │ ├── direct_proxy.rb │ ├── dns_record.rb │ ├── dns_service.rb │ ├── event_base.rb │ ├── filter.rb │ ├── filter_static.rb │ ├── interface.rb │ ├── interface_assoc.rb │ ├── interface_port.rb │ ├── ip_lease.rb │ ├── ip_lease_container.rb │ ├── ip_retention.rb │ ├── ip_retention_container.rb │ ├── lease_policy.rb │ ├── mac_lease.rb │ ├── mac_range.rb │ ├── models.rb │ ├── network.rb │ ├── network_service.rb │ ├── route.rb │ ├── route_link.rb │ ├── rpc_proxy.rb │ ├── segment.rb │ ├── topology.rb │ ├── translation.rb │ ├── translation_static_address.rb │ └── tunnel.rb │ ├── node_modules │ ├── event_handler.rb │ ├── rpc.rb │ ├── service_openflow.rb │ └── service_watchdog.rb │ ├── openflow │ ├── arp_lookup.rb │ ├── controller.rb │ ├── datapath.rb │ ├── flow.rb │ ├── flow_helpers.rb │ ├── metadata_helpers.rb │ ├── ovs_ofctl.rb │ ├── packet_handler.rb │ ├── switch.rb │ └── trema_tasks.rb │ ├── params.rb │ ├── rubygems.rb │ └── services │ ├── ip_retention_container_manager.rb │ ├── ip_retention_containers │ └── base.rb │ ├── items.rb │ ├── lease_policies │ ├── base.rb │ └── simple.rb │ ├── lease_policy.rb │ ├── lease_policy_manager.rb │ ├── manager.rb │ ├── topologies │ ├── base.rb │ ├── simple_overlay.rb │ └── simple_underlay.rb │ ├── topology_manager.rb │ ├── vnet_info.rb │ └── vnmgr.rb ├── rack └── config-webapi.ru ├── spec ├── client │ └── ruby │ │ └── ruby_client_spec.rb ├── config │ ├── common.conf │ ├── common2.conf │ ├── vna.conf │ ├── vnmgr.conf │ └── webapi.conf ├── fabricators │ ├── datapath_fabricator.rb │ ├── datapath_network_fabricator.rb │ ├── datapath_route_link_fabricator.rb │ ├── datapath_segment_fabricator.rb │ ├── dns_record_fabricator.rb │ ├── dns_service_fabricator.rb │ ├── filter_fabricator.rb │ ├── filter_static_fabricator.rb │ ├── interface_assoc_fabricator.rb │ ├── interface_fabricator.rb │ ├── ip_address_fabricator.rb │ ├── ip_lease_container_fabricator.rb │ ├── ip_lease_fabricator.rb │ ├── ip_range_fabricator.rb │ ├── ip_range_group_fabricator.rb │ ├── ip_retention_container_fabricator.rb │ ├── ip_retention_fabricator.rb │ ├── lease_policy_base_interface_fabricator.rb │ ├── lease_policy_base_network_fabricator.rb │ ├── lease_policy_fabricator.rb │ ├── lease_policy_ip_lease_container_fabricator.rb │ ├── lease_policy_ip_retention_container_fabricator.rb │ ├── mac_address_fabricator.rb │ ├── mac_lease_fabricator.rb │ ├── mac_range_fabricator.rb │ ├── mac_range_group_fabricator.rb │ ├── network_fabricator.rb │ ├── network_service_fabricator.rb │ ├── route_fabricator.rb │ ├── route_link_fabricator.rb │ ├── segment_fabricator.rb │ ├── topology_fabricator.rb │ ├── translation.rb │ └── translation_static_address.rb ├── helpers │ ├── event.rb │ ├── fabricate.rb │ ├── item.rb │ ├── manager.rb │ ├── manager_event.rb │ └── model.rb ├── log │ └── .gitignore ├── sequel │ └── plugins │ │ ├── ip_address_spec.rb │ │ └── mac_address_spec.rb ├── spec_helper.rb ├── support │ ├── filter_helper.rb │ ├── let_helper.rb │ ├── mock_datapath.rb │ ├── mock_dp_info.rb │ ├── mock_event_handler.rb │ ├── mock_event_manager.rb │ ├── mock_port_manager.rb │ ├── mock_switch.rb │ ├── mock_vnet_info.rb │ ├── network_helper.rb │ ├── permutation.rb │ ├── publish_event.rb │ └── sequence_helper.rb └── vnet │ ├── configurations │ ├── common_spec.rb │ ├── vna_spec.rb │ ├── vnmgr_spec.rb │ └── webapi_spec.rb │ ├── core │ ├── datapaths │ │ ├── host_spec.rb │ │ ├── remote_spec.rb │ │ └── shared_examples │ │ │ └── added.rb │ ├── filters_spec.rb │ ├── interfaces │ │ └── base_spec.rb │ ├── networks │ │ └── network_virtual_spec.rb │ ├── ports │ │ └── port_tunnel_spec.rb │ ├── service_manager_spec.rb │ └── tunnel_manager_spec.rb │ ├── endpoints │ └── 1.0 │ │ ├── datapaths_spec.rb │ │ ├── dns_services_spec.rb │ │ ├── filters_spec.rb │ │ ├── interfaces_spec.rb │ │ ├── ip_lease_containers_spec.rb │ │ ├── ip_lease_spec.rb │ │ ├── ip_range_groups_spec.rb │ │ ├── ip_retention_containers_spec.rb │ │ ├── lease_policies_spec.rb │ │ ├── mac_lease_spec.rb │ │ ├── mac_range_groups_spec.rb │ │ ├── matchers │ │ ├── fail.rb │ │ ├── helper_methods.rb │ │ └── succeed.rb │ │ ├── network_services_spec.rb │ │ ├── networks_spec.rb │ │ ├── route_links_spec.rb │ │ ├── routes_spec.rb │ │ ├── segments_spec.rb │ │ ├── shared_examples │ │ ├── api_with_uuid_suffix.rb │ │ ├── delete.rb │ │ ├── get.rb │ │ ├── helper_methods.rb │ │ ├── interface_assoc.rb │ │ ├── many_to_many_relation.rb │ │ ├── one_to_many_relation.rb │ │ ├── post.rb │ │ ├── post_with_postfix.rb │ │ ├── put.rb │ │ ├── put_with_postfix.rb │ │ ├── relation_uuid_checks.rb │ │ └── uuid_in_param.rb │ │ ├── topologies_spec.rb │ │ └── translations_spec.rb │ ├── event │ ├── dispachable_spec.rb │ └── notifications_spec.rb │ ├── model_wrappers │ ├── base_spec.rb │ └── network_spec.rb │ ├── models │ ├── datapath_network_spec.rb │ ├── datapath_spec.rb │ ├── interface_spec.rb │ ├── ip_lease_spec.rb │ ├── network_spec.rb │ ├── route_spec.rb │ └── segment_spec.rb │ ├── node_api │ ├── base_spec.rb │ ├── interface_network_spec.rb │ ├── interface_route_link_spec.rb │ ├── interface_segment_spec.rb │ ├── interface_spec.rb │ ├── ip_lease_spec.rb │ ├── ip_retention_container_spec.rb │ ├── ip_retention_spec.rb │ ├── lease_policy_spec.rb │ ├── mac_lease_spec.rb │ ├── network_spec.rb │ ├── proxies_spec.rb │ ├── shared_examples │ │ ├── assoc_item.rb │ │ ├── create_item.rb │ │ ├── delete_item.rb │ │ ├── interface_assoc.rb │ │ └── update_item.rb │ └── topology_spec.rb │ ├── node_modules │ ├── event_handler_spec.rb │ ├── rpc_spec.rb │ └── service_openflow_spec.rb │ ├── openflow │ └── switch_spec.rb │ └── services │ ├── ip_retention_container_manager_spec.rb │ ├── ip_retention_containers │ └── base_spec.rb │ ├── shared_examples │ ├── create_items.rb │ └── delete_items.rb │ └── topology_manager_spec.rb └── tools └── generator /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | trim_trailing_whitespace = true 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 2 9 | 10 | [*.go] 11 | indent_style = tab 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | *.swo 3 | /ruby 4 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | inherit_from: .rubocop_todo.yml 2 | 3 | AllCops: 4 | Include: 5 | - 'client/**/*.rb' 6 | - 'integration_test/**/*.rb' 7 | - 'vnet/rack/**/*' 8 | - 'vnet/spec/**/*.rb' 9 | - 'vnet/tools/*' 10 | Exclude: 11 | - 'vnet/db/migrations/*' 12 | - 'vnet/lib/vnet/node_api/proxies.rb' 13 | - 'vnet/vendor/**/*' 14 | 15 | Style/BlockDelimiters: 16 | Enabled: false 17 | -------------------------------------------------------------------------------- /ci/ci.el6.third-party/packages.d/openvnet-openvswitch/versions: -------------------------------------------------------------------------------- 1 | 2.3.3 2 | 2.4.1 3 | -------------------------------------------------------------------------------- /ci/ci.el6.third-party/packages.d/openvnet-zeromq4/rpmbuild.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # dependencies: rpm-build redhat-rpm-config rpmdevtools yum-utils gcc make 4 | # 5 | 6 | set -e 7 | 8 | rpmdev-setuptree 9 | 10 | cp "$(dirname ${BASH_SOURCE[0]})/openvnet-zeromq4.spec" "$(rpm -E '%{_topdir}')/SPECS/" 11 | 12 | cd $(rpm -E '%{_topdir}') 13 | 14 | spectool -g -R SPECS/openvnet-zeromq4.spec 15 | yum-builddep -y SPECS/openvnet-zeromq4.spec 16 | 17 | rpmbuild -bp SPECS/openvnet-zeromq4.spec 18 | QA_RPATHS=0001 rpmbuild -bb SPECS/openvnet-zeromq4.spec 19 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/build-cache.list: -------------------------------------------------------------------------------- 1 | /usr/local/rvm/gems/ruby-2.3.0 2 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.91/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))/.." && pwd -P)" 4 | export NODE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 5 | TMP_ROOT="${NODE_DIR}/tmp_root" 6 | 7 | . "${ENV_ROOTDIR}/config.source" 8 | . "${NODE_DIR}/vmspec.conf" 9 | . "${ENV_ROOTDIR}/ind-steps/common.source" 10 | 11 | IND_STEPS=( 12 | "box" 13 | "ssh" 14 | "epel" 15 | "redis" 16 | "mysql" 17 | "lxc" 18 | "sclo-ruby" 19 | "nettools" 20 | "openvswitch" 21 | ) 22 | 23 | initialize 24 | build "${IND_STEPS[@]}" 25 | 26 | ( 27 | start_stage=$install \ 28 | build "openvnet" 29 | ) 30 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.91/destroy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))/.." && pwd -P)" 4 | export NODE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 5 | 6 | . "${ENV_ROOTDIR}/config.source" 7 | . "${NODE_DIR}/vmspec.conf" 8 | . "${ENV_ROOTDIR}/ind-steps/step-box/common.source" 9 | 10 | destroy_vm 11 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.91/guestroot/etc/openvnet/common.conf: -------------------------------------------------------------------------------- 1 | registry { 2 | adapter "redis" 3 | host "192.168.2.91" 4 | port 6379 5 | } 6 | 7 | db { 8 | adapter "mysql2" 9 | host "localhost" 10 | database "vnet" 11 | port 3306 12 | user "root" 13 | password "" 14 | } 15 | 16 | datapath_mac_group "mrg-dpg" 17 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.91/guestroot/etc/openvnet/vna.conf: -------------------------------------------------------------------------------- 1 | node { 2 | id "vna1" 3 | addr { 4 | protocol "tcp" 5 | host "192.168.2.91" 6 | port 9103 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.91/guestroot/etc/openvnet/vnmgr.conf: -------------------------------------------------------------------------------- 1 | node { 2 | id "vnmgr" 3 | addr { 4 | protocol "tcp" 5 | host "192.168.2.91" 6 | port 9102 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.91/guestroot/etc/openvnet/webapi.conf: -------------------------------------------------------------------------------- 1 | node { 2 | id "webapi" 3 | addr { 4 | protocol "tcp" 5 | host "192.168.2.91" 6 | port 9101 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.91/guestroot/etc/sysconfig/network: -------------------------------------------------------------------------------- 1 | NETWORKING=yes 2 | HOSTNAME=itest1 3 | GATEWAY=192.168.2.1 4 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.91/guestroot/etc/sysconfig/network-scripts/ifcfg-br1: -------------------------------------------------------------------------------- 1 | DEVICE=br1 2 | ONBOOT=yes 3 | DEVICETYPE=ovs 4 | TYPE=OVSBridge 5 | BOOTPROTO=static 6 | IPADDR=10.50.0.2 7 | NETMASK=255.255.255.0 8 | NETWORK=10.50.0.0 9 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.91/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0: -------------------------------------------------------------------------------- 1 | DEVICE=eth0 2 | ONBOOT=yes 3 | DEVICETYPE=ovs 4 | TYPE=OVSPort 5 | OVS_BRIDGE=br0 6 | BOOTPROTO=none 7 | HOTPLUG=no 8 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.91/guestroot/etc/sysconfig/network-scripts/ifcfg-eth1: -------------------------------------------------------------------------------- 1 | DEVICE=eth1 2 | ONBOOT=yes 3 | TYPE=Ethernet 4 | BOOTPROTO=static 5 | IPADDR=192.168.2.91 6 | NETMASK=255.255.255.0 7 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.91/guestroot/etc/sysconfig/network-scripts/route-br0: -------------------------------------------------------------------------------- 1 | 172.16.91.0/24 via 172.16.90.2 dev br0 -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.91/kill.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))/.." && pwd -P)" 4 | export NODE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 5 | 6 | . "${ENV_ROOTDIR}/config.source" 7 | . "${NODE_DIR}/vmspec.conf" 8 | . "${ENV_ROOTDIR}/ind-steps/step-box/common.source" 9 | 10 | kill_vm 11 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.91/login.sh: -------------------------------------------------------------------------------- 1 | ../login.sh -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.92/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))/.." && pwd -P)" 4 | export NODE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 5 | TMP_ROOT="${NODE_DIR}/tmp_root" 6 | 7 | . "${ENV_ROOTDIR}/config.source" 8 | . "${NODE_DIR}/vmspec.conf" 9 | . "${ENV_ROOTDIR}/ind-steps/common.source" 10 | 11 | IND_STEPS=( 12 | "box" 13 | "ssh" 14 | "epel" 15 | "lxc" 16 | "sclo-ruby" 17 | "nettools" 18 | "openvswitch" 19 | ) 20 | 21 | initialize 22 | build "${IND_STEPS[@]}" 23 | ( 24 | start_stage=$install \ 25 | build "openvnet" 26 | ) 27 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.92/destroy.sh: -------------------------------------------------------------------------------- 1 | ../192.168.2.91/destroy.sh -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.92/guestroot/etc/openvnet/common.conf: -------------------------------------------------------------------------------- 1 | registry { 2 | adapter "redis" 3 | host "192.168.2.91" 4 | port 6379 5 | } 6 | 7 | db { 8 | adapter "mysql2" 9 | host "localhost" 10 | database "vnet" 11 | port 3306 12 | user "root" 13 | password "" 14 | } 15 | 16 | datapath_mac_group "mrg-dpg" 17 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.92/guestroot/etc/openvnet/vna.conf: -------------------------------------------------------------------------------- 1 | node { 2 | id "vna2" 3 | addr { 4 | protocol "tcp" 5 | host "192.168.2.92" 6 | port 9103 7 | } 8 | } -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.92/guestroot/etc/sysconfig/network: -------------------------------------------------------------------------------- 1 | NETWORKING=yes 2 | HOSTNAME=itest2 3 | GATEWAY=192.168.2.1 4 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.92/guestroot/etc/sysconfig/network-scripts/ifcfg-br1: -------------------------------------------------------------------------------- 1 | DEVICE=br1 2 | ONBOOT=yes 3 | DEVICETYPE=ovs 4 | TYPE=OVSBridge 5 | BOOTPROTO=static 6 | IPADDR=10.50.0.2 7 | NETMASK=255.255.255.0 8 | NETWORK=10.50.0.0 -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.92/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0: -------------------------------------------------------------------------------- 1 | DEVICE=eth0 2 | ONBOOT=yes 3 | DEVICETYPE=ovs 4 | TYPE=OVSPort 5 | OVS_BRIDGE=br0 6 | BOOTPROTO=none 7 | HOTPLUG=no -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.92/guestroot/etc/sysconfig/network-scripts/ifcfg-eth1: -------------------------------------------------------------------------------- 1 | DEVICE=eth1 2 | ONBOOT=yes 3 | TYPE=Ethernet 4 | BOOTPROTO=static 5 | IPADDR=192.168.2.92 6 | NETMASK=255.255.255.0 -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.92/guestroot/etc/sysconfig/network-scripts/ifcfg-eth2: -------------------------------------------------------------------------------- 1 | DEVICE=eth2 2 | ONBOOT=yes 3 | DEVICETYPE=ovs 4 | TYPE=OVSPort 5 | OVS_BRIDGE=br0 6 | BOOTPROTO=none 7 | HOTPLUG=no -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.92/guestroot/etc/sysconfig/network-scripts/route-br0: -------------------------------------------------------------------------------- 1 | 172.16.91.0/24 via 172.16.90.2 dev br0 -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.92/kill.sh: -------------------------------------------------------------------------------- 1 | ../192.168.2.91/kill.sh -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.92/login.sh: -------------------------------------------------------------------------------- 1 | ../login.sh -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.93/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))/.." && pwd -P)" 4 | export NODE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 5 | TMP_ROOT="${NODE_DIR}/tmp_root" 6 | 7 | . "${ENV_ROOTDIR}/config.source" 8 | . "${NODE_DIR}/vmspec.conf" 9 | . "${ENV_ROOTDIR}/ind-steps/common.source" 10 | 11 | IND_STEPS=( 12 | "box" 13 | "ssh" 14 | "epel" 15 | "lxc" 16 | "sclo-ruby" 17 | "nettools" 18 | "openvswitch" 19 | ) 20 | 21 | initialize 22 | build "${IND_STEPS[@]}" 23 | ( 24 | start_stage=$install \ 25 | build "openvnet" 26 | ) 27 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.93/destroy.sh: -------------------------------------------------------------------------------- 1 | ../192.168.2.91/destroy.sh -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.93/guestroot/etc/openvnet/common.conf: -------------------------------------------------------------------------------- 1 | registry { 2 | adapter "redis" 3 | host "192.168.2.91" 4 | port 6379 5 | } 6 | 7 | db { 8 | adapter "mysql2" 9 | host "localhost" 10 | database "vnet" 11 | port 3306 12 | user "root" 13 | password "" 14 | } 15 | 16 | datapath_mac_group "mrg-dpg" 17 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.93/guestroot/etc/openvnet/vna.conf: -------------------------------------------------------------------------------- 1 | node { 2 | id "vna3" 3 | addr { 4 | protocol "tcp" 5 | host "192.168.2.93" 6 | port 9103 7 | } 8 | } -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.93/guestroot/etc/sysconfig/network: -------------------------------------------------------------------------------- 1 | NETWORKING=yes 2 | HOSTNAME=itest3 3 | GATEWAY=192.168.2.1 4 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.93/guestroot/etc/sysconfig/network-scripts/ifcfg-br1: -------------------------------------------------------------------------------- 1 | DEVICE=br1 2 | ONBOOT=yes 3 | DEVICETYPE=ovs 4 | TYPE=OVSBridge 5 | BOOTPROTO=static 6 | IPADDR=10.50.0.2 7 | NETMASK=255.255.255.0 8 | NETWORK=10.50.0.0 -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.93/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0: -------------------------------------------------------------------------------- 1 | DEVICE=eth0 2 | ONBOOT=yes 3 | DEVICETYPE=ovs 4 | TYPE=OVSPort 5 | OVS_BRIDGE=br0 6 | BOOTPROTO=none 7 | HOTPLUG=no -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.93/guestroot/etc/sysconfig/network-scripts/ifcfg-eth1: -------------------------------------------------------------------------------- 1 | DEVICE=eth1 2 | ONBOOT=yes 3 | TYPE=Ethernet 4 | BOOTPROTO=static 5 | IPADDR=192.168.2.93 6 | NETMASK=255.255.255.0 -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.93/guestroot/etc/sysconfig/network-scripts/route-br0: -------------------------------------------------------------------------------- 1 | 172.16.90.0/24 via 172.16.91.2 dev br0 -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.93/kill.sh: -------------------------------------------------------------------------------- 1 | ../192.168.2.91/kill.sh -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.93/login.sh: -------------------------------------------------------------------------------- 1 | ../login.sh -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.95/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))/.." && pwd -P)" 4 | export NODE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 5 | TMP_ROOT="${NODE_DIR}/tmp_root" 6 | 7 | . "${ENV_ROOTDIR}/config.source" 8 | . "${NODE_DIR}/vmspec.conf" 9 | . "${ENV_ROOTDIR}/ind-steps/common.source" 10 | 11 | IND_STEPS=( 12 | "box" 13 | "ssh" 14 | ) 15 | 16 | initialize 17 | build "${IND_STEPS[@]}" 18 | 19 | run_cmd "/sbin/sysctl -w net.ipv4.ip_forward=1" 20 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.95/destroy.sh: -------------------------------------------------------------------------------- 1 | ../192.168.2.91/destroy.sh -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.95/guestroot/etc/sysconfig/network: -------------------------------------------------------------------------------- 1 | NETWORKING=yes 2 | HOSTNAME=router 3 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.95/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0: -------------------------------------------------------------------------------- 1 | DEVICE=eth0 2 | ONBOOT=yes 3 | TYPE=Ethernet 4 | BOOTPROTO=static 5 | IPADDR=192.168.2.95 6 | NETMASK=255.255.255.0 7 | NETWORK=192.168.2.0 8 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.95/guestroot/etc/sysconfig/network-scripts/ifcfg-eth1: -------------------------------------------------------------------------------- 1 | DEVICE=eth1 2 | ONBOOT=yes 3 | TYPE=Ethernet 4 | BOOTPROTO=static 5 | IPADDR=172.16.90.2 6 | NETMASK=255.255.255.0 7 | NETWORK=172.16.90.0 8 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.95/guestroot/etc/sysconfig/network-scripts/ifcfg-eth2: -------------------------------------------------------------------------------- 1 | DEVICE=eth2 2 | ONBOOT=yes 3 | TYPE=Ethernet 4 | BOOTPROTO=static 5 | IPADDR=172.16.91.2 6 | NETMASK=255.255.255.0 7 | NETWORK=172.16.91.0 8 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.95/kill.sh: -------------------------------------------------------------------------------- 1 | ../192.168.2.91/kill.sh -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.95/login.sh: -------------------------------------------------------------------------------- 1 | ../login.sh -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.95/vmspec.conf: -------------------------------------------------------------------------------- 1 | vm_name="router" 2 | cpu_type=qemu64,+vmx 3 | mem_size=1024 4 | cpu_num=1 5 | vnc_addr= 6 | vnc_port=14104 7 | serial=telnet:127.0.0.1:14204,server,nowait 8 | 9 | nics[0]="name=95-eth0 hwaddr=52:54:FF:00:15:08 bridge=vnet-br0" 10 | nics[1]="name=95-eth1 hwaddr=52:54:FF:00:15:09 bridge=vnet-itest0" 11 | nics[2]="name=95-eth2 hwaddr=52:54:FF:00:15:10 bridge=vnet-itest1" 12 | 13 | IP_ADDR=192.168.2.95 14 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.96/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))/.." && pwd -P)" 4 | export NODE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 5 | TMP_ROOT="${NODE_DIR}/tmp_root" 6 | 7 | . "${ENV_ROOTDIR}/config.source" 8 | . "${NODE_DIR}/vmspec.conf" 9 | . "${ENV_ROOTDIR}/ind-steps/common.source" 10 | 11 | IND_STEPS=( 12 | "box" 13 | "ssh" 14 | "epel" 15 | "lxc" 16 | "sclo-ruby" 17 | "nettools" 18 | "openvswitch" 19 | ) 20 | 21 | initialize 22 | build "${IND_STEPS[@]}" 23 | ( 24 | start_stage=$install \ 25 | build "openvnet" 26 | ) 27 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.96/destroy.sh: -------------------------------------------------------------------------------- 1 | ../192.168.2.91/destroy.sh -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.96/guestroot/etc/openvnet/common.conf: -------------------------------------------------------------------------------- 1 | registry { 2 | adapter "redis" 3 | host "192.168.2.91" 4 | port 6379 5 | } 6 | 7 | db { 8 | adapter "mysql2" 9 | host "localhost" 10 | database "vnet" 11 | port 3306 12 | user "root" 13 | password "" 14 | } 15 | 16 | datapath_mac_group "mrg-dpg" 17 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.96/guestroot/etc/openvnet/vna.conf: -------------------------------------------------------------------------------- 1 | node { 2 | id "wanedge" 3 | addr { 4 | protocol "tcp" 5 | host "192.168.2.96" 6 | port 9103 7 | } 8 | } 9 | 10 | # 11 | # TODO: 12 | # uuid and gw ip address hard coded 13 | # work only for integration test wanedge scenario 14 | # 15 | network { 16 | uuid "nw-global" 17 | gateway { 18 | address "10.210.0.1" 19 | } 20 | } -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.96/guestroot/etc/sysconfig/network: -------------------------------------------------------------------------------- 1 | NETWORKING=yes 2 | HOSTNAME=wanedge 3 | GATEWAY=192.168.2.1 4 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.96/guestroot/etc/sysconfig/network-scripts/ifcfg-br0: -------------------------------------------------------------------------------- 1 | ONBOOT=yes 2 | DEVICE=br0 3 | ONBOOT=yes 4 | DEVICETYPE=ovs 5 | TYPE=OVSBridge 6 | BOOTPROTO=static 7 | IPADDR=172.16.90.12 8 | NETMASK=255.255.255.0 9 | HOTPLUG=no 10 | OVS_EXTRA=" 11 | set bridge ${DEVICE} protocols=OpenFlow10,OpenFlow12,OpenFlow13 -- 12 | set bridge ${DEVICE} other_config:disable-in-band=true -- 13 | set bridge ${DEVICE} other-config:datapath-id=0000eeeeeeeeeeee -- 14 | set bridge ${DEVICE} other-config:hwaddr=02:01:00:00:00:05 -- 15 | set-fail-mode ${DEVICE} standalone -- 16 | set-controller ${DEVICE} tcp:127.0.0.1:6633 17 | " 18 | #set-controller ${DEVICE} unix:/var/run/openvswitch/${DEVICE}.controller 19 | #set-fail-mode ${DEVICE} secure -- -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.96/guestroot/etc/sysconfig/network-scripts/ifcfg-br1: -------------------------------------------------------------------------------- 1 | DEVICE=br1 2 | ONBOOT=yes 3 | DEVICETYPE=ovs 4 | TYPE=OVSBridge 5 | BOOTPROTO=static 6 | IPADDR=10.50.0.2 7 | NETMASK=255.255.255.0 8 | NETWORK=10.50.0.0 -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.96/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0: -------------------------------------------------------------------------------- 1 | DEVICE=eth0 2 | ONBOOT=yes 3 | DEVICETYPE=ovs 4 | TYPE=OVSPort 5 | OVS_BRIDGE=br0 6 | BOOTPROTO=none 7 | HOTPLUG=no -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.96/guestroot/etc/sysconfig/network-scripts/ifcfg-eth1: -------------------------------------------------------------------------------- 1 | DEVICE=eth1 2 | ONBOOT=yes 3 | TYPE=Ethernet 4 | BOOTPROTO=static 5 | IPADDR=192.168.2.96 6 | NETMASK=255.255.255.0 7 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.96/guestroot/etc/sysconfig/network-scripts/ifcfg-eth2: -------------------------------------------------------------------------------- 1 | DEVICE=eth2 2 | ONBOOT=yes 3 | DEVICETYPE=ovs 4 | TYPE=OVSPort 5 | OVS_BRIDGE=br0 6 | BOOTPROTO=none 7 | HOTPLUG=no 8 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.96/guestroot/etc/sysconfig/network-scripts/route-br0: -------------------------------------------------------------------------------- 1 | 172.16.90.0/24 via 172.16.91.2 dev br0 2 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.96/kill.sh: -------------------------------------------------------------------------------- 1 | ../192.168.2.91/kill.sh -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.96/login.sh: -------------------------------------------------------------------------------- 1 | ../login.sh -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/192.168.2.96/vmspec.conf: -------------------------------------------------------------------------------- 1 | vm_name="wanedge" 2 | cpu_type=qemu64,+vmx 3 | mem_size=1024 4 | cpu_num=1 5 | vnc_addr= 6 | vnc_port=14106 7 | serial=telnet:127.0.0.1:14206,server,nowait 8 | 9 | containers[0]=vm7 10 | 11 | nics[0]="name=96-eth0 hwaddr=52:54:FF:00:15:11 bridge=vnet-itest0" 12 | nics[1]="name=96-eth1 hwaddr=52:54:FF:00:15:12 bridge=vnet-br0" 13 | nics[2]="name=96-eth2 hwaddr=52:54:FF:00:15:13 bridge=vnet-wanedge" 14 | 15 | container_if[0]="container=vm7 ifname=v7 hwaddr=02:00:00:00:00:07 bridge=br0" 16 | container_if[1]="container=vm7 ifname=m7 hwaddr=52:54:FF:00:00:07 bridge=br1 ip_addr=10.50.0.107" 17 | 18 | IP_ADDR=192.168.2.96 19 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/base/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))/.." && pwd -P)" 4 | export NODE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 5 | TMP_ROOT="${NODE_DIR}/tmp_root" 6 | 7 | 8 | . "${ENV_ROOTDIR}/config.source" 9 | . "${NODE_DIR}/vmspec.conf" 10 | . "${ENV_ROOTDIR}/ind-steps/common.source" 11 | 12 | IND_STEPS=( 13 | "box" 14 | "ssh" 15 | "epel" 16 | "lxc" 17 | "sclo-ruby" 18 | "nettools" 19 | "openvswitch" 20 | ) 21 | 22 | initialize 23 | build "${IND_STEPS[@]}" 24 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/base/destroy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))/.." && pwd -P)" 4 | export NODE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 5 | 6 | . "${ENV_ROOTDIR}/config.source" 7 | . "${NODE_DIR}/vmspec.conf" 8 | . "${ENV_ROOTDIR}/ind-steps/step-box/common.source" 9 | 10 | destroy_vm 11 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/base/guestroot/etc/sysconfig/network: -------------------------------------------------------------------------------- 1 | NETWORKING=yes 2 | GATEWAY=192.168.2.1 3 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/base/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0: -------------------------------------------------------------------------------- 1 | DEVICE=eth0 2 | ONBOOT=yes 3 | TYPE=Ethernet 4 | BOOTPROTO=static 5 | IPADDR=192.168.2.90 6 | NETMASK=255.255.255.0 7 | NETWORK=192.168.2.90 8 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/base/guestroot/etc/yum.repos.d/CentOS-Base.repo: -------------------------------------------------------------------------------- 1 | [base] 2 | name=CentOS-$releasever - Base 3 | baseurl=http://ftp.jaist.ac.jp/pub/Linux/CentOS/6/os/$basearch/ 4 | gpgcheck=1 5 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 6 | 7 | [updates] 8 | name=CentOS-$releasever - Updates 9 | baseurl=http://ftp.jaist.ac.jp/pub/Linux/CentOS/6/updates/$basearch/ 10 | gpgcheck=1 11 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 12 | 13 | [extras] 14 | name=CentOS-$releasever - Extras 15 | baseurl=http://ftp.jaist.ac.jp/pub/Linux/CentOS/6/extras/$basearch/ 16 | gpgcheck=1 17 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/base/kill.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))/.." && pwd -P)" 4 | export NODE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 5 | 6 | . "${ENV_ROOTDIR}/config.source" 7 | . "${NODE_DIR}/vmspec.conf" 8 | . "${ENV_ROOTDIR}/ind-steps/step-box/common.source" 9 | 10 | kill_vm 11 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/base/vmspec.conf: -------------------------------------------------------------------------------- 1 | vm_name="base" -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/destroy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))" && pwd -P)" 4 | . "${ENV_ROOTDIR}/ind-steps/common.source" 5 | . "${ENV_ROOTDIR}/ind-steps/step-buildenv/common.source" 6 | . "${ENV_ROOTDIR}/config.source" 7 | 8 | scheduled_nodes=${NODES[@]} 9 | [[ -n "$1" ]] && scheduled_nodes="${@}" 10 | 11 | initialize 12 | teardown_environment 13 | teardown_host_settings 14 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/external_libraries/README.md: -------------------------------------------------------------------------------- 1 | All repositories in this directory were added with `git-subtree`. Take some time to familiarize yourself with `git-subtree` before making changes here. [This blog](http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/) is a good place to start. 2 | 3 | The repositories were subtreed from the following locations: 4 | 5 | * bashsteps: https://github.com/axsh/bashsteps 6 | * mount-partition: https://github.com/triggers/mount-partition 7 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/ind-steps/step-box/postconfigure.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | run_cmd "iptables -F" 4 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/ind-steps/step-buildenv/boot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for node in ${scheduled_nodes[@]} ; do 4 | ( 5 | $starting_group "Building ${node%,*}" 6 | [[ "${node}" == "base" && -f "${CACHE_DIR}/${BRANCH}/box-disk1.raw" ]] 7 | $skip_group_if_unnecessary 8 | "${ENV_ROOTDIR}/${node}/build.sh" 9 | ) ; prev_cmd_failed 10 | done 11 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/ind-steps/step-buildenv/preconfigure.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | $REBUILD && { 4 | rm -rf "${CACHE_DIR}/${BRANCH}" 5 | teardown_environment 6 | } || { 7 | ( 8 | $starting_step "Clone base images from ${BASE_BRANCH}" 9 | [ -d "${CACHE_DIR}/${BRANCH}" -o ! -d "${CACHE_DIR}/${BASE_BRANCH}" ] 10 | $skip_step_if_already_done ; set -ex 11 | cp -r "${CACHE_DIR}/${BASE_BRANCH}" "${CACHE_DIR}/${BRANCH}" 12 | ) ; prev_cmd_failed 13 | } 14 | 15 | ( 16 | $starting_step "Create cache folder" 17 | [ -d "${CACHE_DIR}/${BRANCH}" ] 18 | $skip_step_if_already_done ; set -ex 19 | mkdir -p "${CACHE_DIR}/${BRANCH}" 20 | ) ; prev_cmd_failed 21 | 22 | masquerade "${ip_mng_br0}" 23 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/ind-steps/step-epel/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | install_package "epel-release" 4 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/ind-steps/step-lxc/postconfigure.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ( 4 | $starting_step "Setup LXC" 5 | run_cmd "mount | grep -q cgroup" 6 | $skip_step_if_already_done; set -xe 7 | run_cmd <> /etc/fstab 10 | mount /cgroup 11 | EOS 12 | ) ; prev_cmd_failed 13 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/ind-steps/step-mysql/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | install_package "mysql-server" "mysql" 4 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/ind-steps/step-mysql/provide.sh: -------------------------------------------------------------------------------- 1 | 2 | start_service "mysqld" 3 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/ind-steps/step-nettools/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Needed for ifconfig which is used by the net-dhcp gem in openvnet 4 | install_package "tcpdump" 5 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/ind-steps/step-openvswitch/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ( 4 | $starting_step "Set up OpenVNet third party repo for openvswitch" 5 | [[ -f ${TMP_ROOT}/etc/yum.repos.d/openvnet-third-party.repo ]] 6 | $skip_step_if_already_done; set -xe 7 | sudo chroot ${TMP_ROOT} /bin/bash -c "cat > /etc/yum.repos.d/openvnet-third-party.repo < /dev/null 12 | $skip_step_if_already_done 13 | run_cmd "yum-config-manager --enable rhel-server-rhscl-6-rpms" 14 | ) ; prev_cmd_failed 15 | install_package "${BOXES_SCL_RUBY}" "${BOXES_SCL_RUBY}-rubygem-bundler" "${BOXES_SCL_RUBY}-rubygem-rake" 16 | ) ; prev_cmd_failed 17 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/ind-steps/step-ssh/boot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ( 4 | $starting_step "Import ssh key" 5 | [ -f ${NODE_DIR}/sshkey ] 6 | $skip_step_if_already_done 7 | cp ${CACHE_DIR}/${BRANCH}/sshkey ${NODE_DIR}/sshkey 8 | chown ${USER}:${USER} ${NODE_DIR}/sshkey 9 | ) ; prev_cmd_failed 10 | 11 | ( 12 | $starting_step "Wait for ssh" 13 | [[ "$(nc ${IP_ADDR} 22 < /dev/null)" == *"SSH"* ]] 14 | $skip_step_if_already_done ; set -xe 15 | timeout=15 16 | while ! run_cmd "uptime" > /dev/null ; do 17 | sleep 5 18 | tries=$(( tries + 1 )) 19 | [[ $tries -eq ${timeout} ]] && exit 255 20 | done 21 | : 22 | ) ; prev_cmd_failed 23 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/ind-steps/step-ssh/common.source: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function add_user_key () { 4 | local user="${1}" 5 | 6 | rm -f ${NODE_DIR}/sshkey 7 | rm -f ${NODE_DIR}/sshkey.pub 8 | ssh-keygen -t rsa -b 2048 -N "" -f ${NODE_DIR}/sshkey 9 | chmod 600 ${NODE_DIR}/sshkey 10 | } 11 | 12 | function install_user_key () { 13 | local user="${1}" 14 | 15 | run_cmd "mkdir -p -m 600 /${user}/.ssh" 16 | sudo cp "${CACHE_DIR}/${BRANCH}/sshkey" "${TMP_ROOT}/${user}/.ssh/id_rsa" 17 | sudo cp "${CACHE_DIR}/${BRANCH}/sshkey.pub" "${TMP_ROOT}/${user}/.ssh/authorized_keys" 18 | } 19 | 20 | ci_user="${user:-root}" 21 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/multibox/kill.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))" && pwd -P)" 4 | . "${ENV_ROOTDIR}/ind-steps/common.source" 5 | . "${ENV_ROOTDIR}/ind-steps/step-buildenv/common.source" 6 | . "${ENV_ROOTDIR}/config.source" 7 | 8 | scheduled_nodes=${NODES[@]} 9 | [[ -n "$1" ]] && scheduled_nodes="${@}" 10 | 11 | initialize 12 | teardown_environment $provide 13 | teardown_host_settings 14 | -------------------------------------------------------------------------------- /ci/ci.el6/integration_test/run_tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | current_dir=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd) 4 | 5 | ${current_dir}/multibox/build.sh 6 | 7 | . ${current_dir}/../../cache_functions.sh "openvnet-ci/el6/branches/${BRANCH}" 8 | . /etc/profile.d/rvm.sh 9 | 10 | 11 | try_load_cache "/data" "/data" "${COMMIT_ID}" 12 | 13 | rvm use 2.3.0 14 | gem install bundler 15 | cd integration_test 16 | bundle install 17 | 18 | create_cache "/data" "/data" "${COMMIT_ID}" "${current_dir}/build-cache.list" 19 | 20 | set -xe 21 | 22 | RELEASE_VERSION="el6" bin/itest-spec run 23 | -------------------------------------------------------------------------------- /ci/ci.el6/rspec_rpmbuild/build-cache.list: -------------------------------------------------------------------------------- 1 | var/tmp/rpmbuild/SOURCES/openvnet/vnet/vendor 2 | var/tmp/rpmbuild/SOURCES/openvnet/client/vnctl/vendor 3 | var/tmp/openvnet/vnet/vendor -------------------------------------------------------------------------------- /ci/ci.el6/rspec_rpmbuild/conf_files/etc/default/openvnet: -------------------------------------------------------------------------------- 1 | # OpenVNet common variables 2 | VNET_ROOT=/opt/axsh/openvnet 3 | LOG_DIRECTORY=/var/log/openvnet/ 4 | 5 | # SCLO ruby 6 | SCL_RUBY=rh-ruby23 7 | . /usr/bin/scl_source enable ${SCL_RUBY} || : -------------------------------------------------------------------------------- /ci/ci.el6/rspec_rpmbuild/conf_files/etc/default/vnet-redis-monitor: -------------------------------------------------------------------------------- 1 | [ -f /etc/default/openvnet ] && . /etc/default/openvnet 2 | VNET_USER=root 3 | -------------------------------------------------------------------------------- /ci/ci.el6/rspec_rpmbuild/conf_files/etc/default/vnet-vna: -------------------------------------------------------------------------------- 1 | [ -f /etc/default/openvnet ] && . /etc/default/openvnet 2 | -------------------------------------------------------------------------------- /ci/ci.el6/rspec_rpmbuild/conf_files/etc/default/vnet-vnmgr: -------------------------------------------------------------------------------- 1 | [ -f /etc/default/openvnet ] && . /etc/default/openvnet 2 | VNET_USER=vnet-vnmgr 3 | -------------------------------------------------------------------------------- /ci/ci.el6/rspec_rpmbuild/conf_files/etc/default/vnet-webapi: -------------------------------------------------------------------------------- 1 | [ -f /etc/default/openvnet ] && . /etc/default/openvnet 2 | BIND_ADDR=0.0.0.0 3 | PORT=9090 4 | RACK_ENV=production 5 | VNET_USER=vnet-webapi 6 | -------------------------------------------------------------------------------- /ci/ci.el6/rspec_rpmbuild/conf_files/etc/init/vnet-redis-monitor.conf: -------------------------------------------------------------------------------- 1 | description "OpenVNet: Redis monitor" 2 | author "axsh Co." 3 | 4 | respawn 5 | respawn limit 5 60 6 | 7 | ## agent name 8 | env NAME=redis-monitor 9 | 10 | script 11 | [ -f /etc/default/vnet-${NAME} ] && . /etc/default/vnet-${NAME} 12 | export LOG_DIRECTORY 13 | 14 | [ -d "${VNET_ROOT}" ] || { 15 | logger "no such directory: ${VNET_ROOT}" 16 | exit 1 17 | } 18 | cd ${VNET_ROOT}/vnet/ 19 | 20 | su ${VNET_USER} -s /bin/sh -c "exec bundle exec ./bin/${NAME}" >> ${LOG_DIRECTORY}/${NAME}.log 2>&1 21 | end script 22 | -------------------------------------------------------------------------------- /ci/ci.el6/rspec_rpmbuild/conf_files/etc/init/vnet-vna.conf: -------------------------------------------------------------------------------- 1 | description "OpenVNet: Database agent" 2 | author "axsh Co." 3 | 4 | respawn 5 | respawn limit 5 60 6 | 7 | ## agent name 8 | env NAME=vna 9 | 10 | script 11 | [ -f /etc/default/vnet-${NAME} ] && . /etc/default/vnet-${NAME} 12 | export LOG_DIRECTORY 13 | 14 | [ -d "${LOG_DIRECTORY}" ] || { 15 | mkdir ${LOG_DIRECTORY} 16 | } 17 | 18 | [ -d "${VNET_ROOT}" ] || { 19 | logger "no such directory: ${VNET_ROOT}" 20 | exit 1 21 | } 22 | cd ${VNET_ROOT}/vnet/ 23 | 24 | exec bundle exec ./bin/${NAME} \ 25 | >> ${LOG_DIRECTORY}/${NAME}.log 2>&1 26 | end script 27 | -------------------------------------------------------------------------------- /ci/ci.el6/rspec_rpmbuild/conf_files/etc/init/vnet-vnmgr.conf: -------------------------------------------------------------------------------- 1 | description "OpenVNet: Database agent" 2 | author "axsh Co." 3 | 4 | respawn 5 | respawn limit 5 60 6 | 7 | ## agent name 8 | env NAME=vnmgr 9 | 10 | script 11 | ## Uncomment next 2 lines to enable logging of this upstart script 12 | #exec 2>>/var/log/openvnet/vnmgr-upstart.log 13 | #set -x 14 | 15 | [ -f /etc/default/vnet-${NAME} ] && . /etc/default/vnet-${NAME} 16 | export LOG_DIRECTORY 17 | 18 | [ -d "${VNET_ROOT}" ] || { 19 | logger "no such directory: ${VNET_ROOT}" 20 | exit 1 21 | } 22 | cd ${VNET_ROOT}/vnet/ 23 | 24 | su ${VNET_USER} -s /bin/sh -c "exec bundle exec ./bin/${NAME}" >> ${LOG_DIRECTORY}/${NAME}.log 2>&1 25 | end script 26 | -------------------------------------------------------------------------------- /ci/ci.el6/rspec_rpmbuild/conf_files/etc/openvnet/vnctl-ruby: -------------------------------------------------------------------------------- 1 | # . scl_source enable is written by rpmbuild. 2 | -------------------------------------------------------------------------------- /ci/ci.el6/rspec_rpmbuild/conf_files/etc/openvnet/vnctl.conf: -------------------------------------------------------------------------------- 1 | # webapi_protocol 'http' 2 | # webapi_uri '127.0.0.1' 3 | # webapi_port '9090' 4 | # webapi_version '1.0' 5 | # output_format 'yml' 6 | -------------------------------------------------------------------------------- /ci/ci.el6/rspec_rpmbuild/conf_files/usr/bin/vnctl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | vnctl_path="/opt/axsh/openvnet/client/vnctl/bin/vnctl" 4 | 5 | [ -f /etc/openvnet/vnctl-ruby ] && . /etc/openvnet/vnctl-ruby 6 | 7 | set -e 8 | $vnctl_path "$@" 9 | -------------------------------------------------------------------------------- /ci/ci.el6/rspec_rpmbuild/fastestmirror.conf: -------------------------------------------------------------------------------- 1 | [main] 2 | enabled=1 3 | verbose=0 4 | always_print_best_host = true 5 | socket_timeout=3 6 | # Relative paths are relative to the cachedir (and so works for users as well 7 | # as root). 8 | hostfilepath=timedhosts.txt 9 | maxhostfileage=10 10 | maxthreads=15 11 | #exclude=.gov, facebook 12 | #include_only=.nl,.de,.uk,.ie 13 | include_only=.jp 14 | -------------------------------------------------------------------------------- /ci/ci.el6/rspec_rpmbuild/yum.repo/dev.repo: -------------------------------------------------------------------------------- 1 | [openvnet] 2 | name=OpenVNet Repo - CI 3 | baseurl=https://ci.openvnet.org/repos/$branch/packages/rhel/$releasever/vnet/$ovn_release_suffix/ 4 | enabled=1 5 | gpgcheck=0 6 | 7 | [openvnet-third-party] 8 | name=OpenVNet Third Party Repo - CI 9 | baseurl=https://ci.openvnet.org/repos/packages/rhel/$releasever/third_party/current/ 10 | enabled=1 11 | gpgcheck=0 12 | -------------------------------------------------------------------------------- /ci/ci.el7.third-party/packages.d/openvnet-openvswitch/versions: -------------------------------------------------------------------------------- 1 | 2.3.3 2 | 2.4.1 3 | 2.5.0 -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/build-cache.list: -------------------------------------------------------------------------------- 1 | /usr/local/rvm/gems/ruby-2.3.0 2 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.91/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))/.." && pwd -P)" 4 | export NODE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 5 | TMP_ROOT="${NODE_DIR}/tmp_root" 6 | 7 | . "${ENV_ROOTDIR}/config.source" 8 | . "${NODE_DIR}/vmspec.conf" 9 | . "${ENV_ROOTDIR}/ind-steps/common.source" 10 | 11 | ovn_vnmgr=true 12 | ovn_webapi=true 13 | 14 | IND_STEPS=( 15 | "box" 16 | "ssh" 17 | "epel" 18 | "redis" 19 | "mysql" 20 | "lxc" 21 | "sclo-ruby" 22 | "nettools" 23 | "openvswitch" 24 | ) 25 | 26 | initialize 27 | build "${IND_STEPS[@]}" 28 | 29 | ( 30 | start_stage=$install \ 31 | build "openvnet" 32 | ) 33 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.91/destroy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))/.." && pwd -P)" 4 | export NODE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 5 | 6 | . "${ENV_ROOTDIR}/config.source" 7 | . "${NODE_DIR}/vmspec.conf" 8 | . "${ENV_ROOTDIR}/ind-steps/step-box/common.source" 9 | 10 | destroy_vm 11 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.91/guestroot/etc/default/openvnet: -------------------------------------------------------------------------------- 1 | # OpenVNet common variables 2 | VNET_ROOT=/opt/axsh/openvnet 3 | RUBY_PATH=/opt/axsh/openvnet/ruby/bin 4 | PATH=${RUBY_PATH}:$PATH 5 | LOG_DIRECTORY=/var/log/openvnet/ 6 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.91/guestroot/etc/default/vnet-vna: -------------------------------------------------------------------------------- 1 | [ -f /etc/default/openvnet ] && . /etc/default/openvnet 2 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.91/guestroot/etc/default/vnet-vnmgr: -------------------------------------------------------------------------------- 1 | [ -f /etc/default/openvnet ] && . /etc/default/openvnet 2 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.91/guestroot/etc/default/vnet-webapi: -------------------------------------------------------------------------------- 1 | [ -f /etc/default/openvnet ] && . /etc/default/openvnet 2 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.91/guestroot/etc/openvnet/common.conf: -------------------------------------------------------------------------------- 1 | registry { 2 | adapter "redis" 3 | host "192.168.2.91" 4 | port 6379 5 | } 6 | 7 | db { 8 | adapter "mysql2" 9 | host "localhost" 10 | database "vnet" 11 | port 3306 12 | user "root" 13 | password "" 14 | } 15 | 16 | datapath_mac_group "mrg-dpg" 17 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.91/guestroot/etc/openvnet/vna.conf: -------------------------------------------------------------------------------- 1 | node { 2 | id "vna1" 3 | addr { 4 | protocol "tcp" 5 | host "192.168.2.91" 6 | port 9103 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.91/guestroot/etc/openvnet/vnmgr.conf: -------------------------------------------------------------------------------- 1 | node { 2 | id "vnmgr" 3 | addr { 4 | protocol "tcp" 5 | host "192.168.2.91" 6 | port 9102 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.91/guestroot/etc/openvnet/webapi.conf: -------------------------------------------------------------------------------- 1 | node { 2 | id "webapi" 3 | addr { 4 | protocol "tcp" 5 | host "192.168.2.91" 6 | port 9101 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.91/guestroot/etc/sysconfig/network: -------------------------------------------------------------------------------- 1 | NETWORKING=yes 2 | HOSTNAME=itest1 3 | GATEWAY=192.168.2.1 4 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.91/guestroot/etc/sysconfig/network-scripts/ifcfg-br1: -------------------------------------------------------------------------------- 1 | DEVICE=br1 2 | ONBOOT=yes 3 | DEVICETYPE=ovs 4 | TYPE=OVSBridge 5 | BOOTPROTO=static 6 | IPADDR=10.50.0.2 7 | NETMASK=255.255.255.0 8 | NETWORK=10.50.0.0 9 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.91/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0: -------------------------------------------------------------------------------- 1 | DEVICE=eth0 2 | ONBOOT=yes 3 | DEVICETYPE=ovs 4 | TYPE=OVSPort 5 | OVS_BRIDGE=br0 6 | BOOTPROTO=none 7 | HOTPLUG=no 8 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.91/guestroot/etc/sysconfig/network-scripts/ifcfg-eth1: -------------------------------------------------------------------------------- 1 | DEVICE=eth1 2 | ONBOOT=yes 3 | TYPE=Ethernet 4 | BOOTPROTO=static 5 | IPADDR=192.168.2.91 6 | NETMASK=255.255.255.0 7 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.91/guestroot/etc/sysconfig/network-scripts/route-br0: -------------------------------------------------------------------------------- 1 | 172.16.91.0/24 via 172.16.90.2 dev br0 -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.91/kill.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))/.." && pwd -P)" 4 | export NODE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 5 | 6 | . "${ENV_ROOTDIR}/config.source" 7 | . "${NODE_DIR}/vmspec.conf" 8 | . "${ENV_ROOTDIR}/ind-steps/step-box/common.source" 9 | 10 | kill_vm 11 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.91/login.sh: -------------------------------------------------------------------------------- 1 | ../login.sh -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.91/run_cmd.sh: -------------------------------------------------------------------------------- 1 | ../run_cmd.sh -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.92/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))/.." && pwd -P)" 4 | export NODE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 5 | TMP_ROOT="${NODE_DIR}/tmp_root" 6 | 7 | . "${ENV_ROOTDIR}/config.source" 8 | . "${NODE_DIR}/vmspec.conf" 9 | . "${ENV_ROOTDIR}/ind-steps/common.source" 10 | 11 | IND_STEPS=( 12 | "box" 13 | "ssh" 14 | "epel" 15 | "lxc" 16 | "sclo-ruby" 17 | "nettools" 18 | "openvswitch" 19 | ) 20 | 21 | initialize 22 | build "${IND_STEPS[@]}" 23 | ( 24 | start_stage=$install \ 25 | build "openvnet" 26 | ) 27 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.92/destroy.sh: -------------------------------------------------------------------------------- 1 | ../192.168.2.91/destroy.sh -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.92/guestroot/etc/default/openvnet: -------------------------------------------------------------------------------- 1 | # OpenVNet common variables 2 | VNET_ROOT=/opt/axsh/openvnet 3 | RUBY_PATH=/opt/axsh/openvnet/ruby/bin 4 | PATH=${RUBY_PATH}:$PATH 5 | LOG_DIRECTORY=/var/log/openvnet/ 6 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.92/guestroot/etc/default/vnet-vna: -------------------------------------------------------------------------------- 1 | [ -f /etc/default/openvnet ] && . /etc/default/openvnet -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.92/guestroot/etc/openvnet/common.conf: -------------------------------------------------------------------------------- 1 | registry { 2 | adapter "redis" 3 | host "192.168.2.91" 4 | port 6379 5 | } 6 | 7 | db { 8 | adapter "mysql2" 9 | host "localhost" 10 | database "vnet" 11 | port 3306 12 | user "root" 13 | password "" 14 | } 15 | 16 | datapath_mac_group "mrg-dpg" 17 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.92/guestroot/etc/openvnet/vna.conf: -------------------------------------------------------------------------------- 1 | node { 2 | id "vna2" 3 | addr { 4 | protocol "tcp" 5 | host "192.168.2.92" 6 | port 9103 7 | } 8 | } -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.92/guestroot/etc/sysconfig/network: -------------------------------------------------------------------------------- 1 | NETWORKING=yes 2 | HOSTNAME=itest2 3 | GATEWAY=192.168.2.1 4 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.92/guestroot/etc/sysconfig/network-scripts/ifcfg-br1: -------------------------------------------------------------------------------- 1 | DEVICE=br1 2 | ONBOOT=yes 3 | DEVICETYPE=ovs 4 | TYPE=OVSBridge 5 | BOOTPROTO=static 6 | IPADDR=10.50.0.2 7 | NETMASK=255.255.255.0 8 | NETWORK=10.50.0.0 -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.92/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0: -------------------------------------------------------------------------------- 1 | DEVICE=eth0 2 | ONBOOT=yes 3 | DEVICETYPE=ovs 4 | TYPE=OVSPort 5 | OVS_BRIDGE=br0 6 | BOOTPROTO=none 7 | HOTPLUG=no -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.92/guestroot/etc/sysconfig/network-scripts/ifcfg-eth1: -------------------------------------------------------------------------------- 1 | DEVICE=eth1 2 | ONBOOT=yes 3 | TYPE=Ethernet 4 | BOOTPROTO=static 5 | IPADDR=192.168.2.92 6 | NETMASK=255.255.255.0 -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.92/guestroot/etc/sysconfig/network-scripts/ifcfg-eth2: -------------------------------------------------------------------------------- 1 | DEVICE=eth2 2 | ONBOOT=yes 3 | DEVICETYPE=ovs 4 | TYPE=OVSPort 5 | OVS_BRIDGE=br0 6 | BOOTPROTO=none 7 | HOTPLUG=no -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.92/guestroot/etc/sysconfig/network-scripts/route-br0: -------------------------------------------------------------------------------- 1 | 172.16.91.0/24 via 172.16.90.2 dev br0 -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.92/kill.sh: -------------------------------------------------------------------------------- 1 | ../192.168.2.91/kill.sh -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.92/login.sh: -------------------------------------------------------------------------------- 1 | ../login.sh -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.92/run_cmd.sh: -------------------------------------------------------------------------------- 1 | ../run_cmd.sh -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.93/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))/.." && pwd -P)" 4 | export NODE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 5 | TMP_ROOT="${NODE_DIR}/tmp_root" 6 | 7 | . "${ENV_ROOTDIR}/config.source" 8 | . "${NODE_DIR}/vmspec.conf" 9 | . "${ENV_ROOTDIR}/ind-steps/common.source" 10 | 11 | IND_STEPS=( 12 | "box" 13 | "ssh" 14 | "epel" 15 | "lxc" 16 | "sclo-ruby" 17 | "nettools" 18 | "openvswitch" 19 | ) 20 | 21 | initialize 22 | build "${IND_STEPS[@]}" 23 | ( 24 | start_stage=$install \ 25 | build "openvnet" 26 | ) 27 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.93/destroy.sh: -------------------------------------------------------------------------------- 1 | ../192.168.2.91/destroy.sh -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.93/guestroot/etc/default/openvnet: -------------------------------------------------------------------------------- 1 | # OpenVNet common variables 2 | VNET_ROOT=/opt/axsh/openvnet 3 | RUBY_PATH=/opt/axsh/openvnet/ruby/bin 4 | PATH=${RUBY_PATH}:$PATH 5 | LOG_DIRECTORY=/var/log/openvnet/ 6 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.93/guestroot/etc/default/vnet-vna: -------------------------------------------------------------------------------- 1 | [ -f /etc/default/openvnet ] && . /etc/default/openvnet -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.93/guestroot/etc/openvnet/common.conf: -------------------------------------------------------------------------------- 1 | registry { 2 | adapter "redis" 3 | host "192.168.2.91" 4 | port 6379 5 | } 6 | 7 | db { 8 | adapter "mysql2" 9 | host "localhost" 10 | database "vnet" 11 | port 3306 12 | user "root" 13 | password "" 14 | } 15 | 16 | datapath_mac_group "mrg-dpg" 17 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.93/guestroot/etc/openvnet/vna.conf: -------------------------------------------------------------------------------- 1 | node { 2 | id "vna3" 3 | addr { 4 | protocol "tcp" 5 | host "192.168.2.93" 6 | port 9103 7 | } 8 | } -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.93/guestroot/etc/sysconfig/network: -------------------------------------------------------------------------------- 1 | NETWORKING=yes 2 | HOSTNAME=itest3 3 | GATEWAY=192.168.2.1 4 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.93/guestroot/etc/sysconfig/network-scripts/ifcfg-br1: -------------------------------------------------------------------------------- 1 | DEVICE=br1 2 | ONBOOT=yes 3 | DEVICETYPE=ovs 4 | TYPE=OVSBridge 5 | BOOTPROTO=static 6 | IPADDR=10.50.0.2 7 | NETMASK=255.255.255.0 8 | NETWORK=10.50.0.0 -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.93/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0: -------------------------------------------------------------------------------- 1 | DEVICE=eth0 2 | ONBOOT=yes 3 | DEVICETYPE=ovs 4 | TYPE=OVSPort 5 | OVS_BRIDGE=br0 6 | BOOTPROTO=none 7 | HOTPLUG=no -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.93/guestroot/etc/sysconfig/network-scripts/ifcfg-eth1: -------------------------------------------------------------------------------- 1 | DEVICE=eth1 2 | ONBOOT=yes 3 | TYPE=Ethernet 4 | BOOTPROTO=static 5 | IPADDR=192.168.2.93 6 | NETMASK=255.255.255.0 -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.93/guestroot/etc/sysconfig/network-scripts/route-br0: -------------------------------------------------------------------------------- 1 | 172.16.90.0/24 via 172.16.91.2 dev br0 -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.93/kill.sh: -------------------------------------------------------------------------------- 1 | ../192.168.2.91/kill.sh -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.93/login.sh: -------------------------------------------------------------------------------- 1 | ../login.sh -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.93/run_cmd.sh: -------------------------------------------------------------------------------- 1 | ../run_cmd.sh -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.95/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))/.." && pwd -P)" 4 | export NODE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 5 | TMP_ROOT="${NODE_DIR}/tmp_root" 6 | 7 | . "${ENV_ROOTDIR}/config.source" 8 | . "${NODE_DIR}/vmspec.conf" 9 | . "${ENV_ROOTDIR}/ind-steps/common.source" 10 | 11 | IND_STEPS=( 12 | "box" 13 | "ssh" 14 | ) 15 | 16 | initialize 17 | build "${IND_STEPS[@]}" 18 | 19 | run_cmd "/sbin/sysctl -w net.ipv4.ip_forward=1" 20 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.95/destroy.sh: -------------------------------------------------------------------------------- 1 | ../192.168.2.91/destroy.sh -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.95/guestroot/etc/sysconfig/network: -------------------------------------------------------------------------------- 1 | NETWORKING=yes 2 | HOSTNAME=router 3 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.95/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0: -------------------------------------------------------------------------------- 1 | DEVICE=eth0 2 | ONBOOT=yes 3 | TYPE=Ethernet 4 | BOOTPROTO=static 5 | IPADDR=192.168.2.95 6 | NETMASK=255.255.255.0 7 | NETWORK=192.168.2.0 8 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.95/guestroot/etc/sysconfig/network-scripts/ifcfg-eth1: -------------------------------------------------------------------------------- 1 | DEVICE=eth1 2 | ONBOOT=yes 3 | TYPE=Ethernet 4 | BOOTPROTO=static 5 | IPADDR=172.16.90.2 6 | NETMASK=255.255.255.0 7 | NETWORK=172.16.90.0 8 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.95/guestroot/etc/sysconfig/network-scripts/ifcfg-eth2: -------------------------------------------------------------------------------- 1 | DEVICE=eth2 2 | ONBOOT=yes 3 | TYPE=Ethernet 4 | BOOTPROTO=static 5 | IPADDR=172.16.91.2 6 | NETMASK=255.255.255.0 7 | NETWORK=172.16.91.0 8 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.95/kill.sh: -------------------------------------------------------------------------------- 1 | ../192.168.2.91/kill.sh -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.95/login.sh: -------------------------------------------------------------------------------- 1 | ../login.sh -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.95/run_cmd.sh: -------------------------------------------------------------------------------- 1 | ../run_cmd.sh -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.95/vmspec.conf: -------------------------------------------------------------------------------- 1 | vm_name="router" 2 | cpu_type=qemu64,+vmx 3 | mem_size=1024 4 | cpu_num=1 5 | vnc_addr= 6 | vnc_port=14104 7 | serial=telnet:127.0.0.1:14204,server,nowait 8 | 9 | nics[0]="name=95-eth0 hwaddr=52:54:FF:00:15:08 bridge=vnet-br0" 10 | nics[1]="name=95-eth1 hwaddr=52:54:FF:00:15:09 bridge=vnet-itest0" 11 | nics[2]="name=95-eth2 hwaddr=52:54:FF:00:15:10 bridge=vnet-itest1" 12 | 13 | IP_ADDR=192.168.2.95 14 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.96/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))/.." && pwd -P)" 4 | export NODE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 5 | TMP_ROOT="${NODE_DIR}/tmp_root" 6 | 7 | . "${ENV_ROOTDIR}/config.source" 8 | . "${NODE_DIR}/vmspec.conf" 9 | . "${ENV_ROOTDIR}/ind-steps/common.source" 10 | 11 | IND_STEPS=( 12 | "box" 13 | "ssh" 14 | "epel" 15 | "lxc" 16 | "sclo-ruby" 17 | "nettools" 18 | "openvswitch" 19 | ) 20 | 21 | initialize 22 | build "${IND_STEPS[@]}" 23 | ( 24 | start_stage=$install \ 25 | build "openvnet" 26 | ) 27 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.96/destroy.sh: -------------------------------------------------------------------------------- 1 | ../192.168.2.91/destroy.sh -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.96/guestroot/etc/default/openvnet: -------------------------------------------------------------------------------- 1 | # OpenVNet common variables 2 | VNET_ROOT=/opt/axsh/openvnet 3 | RUBY_PATH=/opt/axsh/openvnet/ruby/bin 4 | PATH=${RUBY_PATH}:$PATH 5 | LOG_DIRECTORY=/var/log/openvnet/ 6 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.96/guestroot/etc/default/vnet-vna: -------------------------------------------------------------------------------- 1 | [ -f /etc/default/openvnet ] && . /etc/default/openvnet -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.96/guestroot/etc/openvnet/common.conf: -------------------------------------------------------------------------------- 1 | registry { 2 | adapter "redis" 3 | host "192.168.2.91" 4 | port 6379 5 | } 6 | 7 | db { 8 | adapter "mysql2" 9 | host "localhost" 10 | database "vnet" 11 | port 3306 12 | user "root" 13 | password "" 14 | } 15 | 16 | datapath_mac_group "mrg-dpg" 17 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.96/guestroot/etc/openvnet/vna.conf: -------------------------------------------------------------------------------- 1 | node { 2 | id "wanedge" 3 | addr { 4 | protocol "tcp" 5 | host "192.168.2.96" 6 | port 9103 7 | } 8 | } 9 | 10 | # 11 | # TODO: 12 | # uuid and gw ip address hard coded 13 | # work only for integration test wanedge scenario 14 | # 15 | network { 16 | uuid "nw-global" 17 | gateway { 18 | address "10.210.0.1" 19 | } 20 | } -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.96/guestroot/etc/sysconfig/network: -------------------------------------------------------------------------------- 1 | NETWORKING=yes 2 | HOSTNAME=wanedge 3 | GATEWAY=192.168.2.1 4 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.96/guestroot/etc/sysconfig/network-scripts/ifcfg-br0: -------------------------------------------------------------------------------- 1 | ONBOOT=yes 2 | DEVICE=br0 3 | ONBOOT=yes 4 | DEVICETYPE=ovs 5 | TYPE=OVSBridge 6 | BOOTPROTO=static 7 | IPADDR=172.16.90.12 8 | NETMASK=255.255.255.0 9 | HOTPLUG=no 10 | OVS_EXTRA=" 11 | set bridge ${DEVICE} protocols=OpenFlow10,OpenFlow12,OpenFlow13 -- 12 | set bridge ${DEVICE} other_config:disable-in-band=true -- 13 | set bridge ${DEVICE} other-config:datapath-id=0000eeeeeeeeeeee -- 14 | set bridge ${DEVICE} other-config:hwaddr=02:01:00:00:00:05 -- 15 | set-fail-mode ${DEVICE} standalone -- 16 | set-controller ${DEVICE} tcp:127.0.0.1:6633 17 | " 18 | #set-controller ${DEVICE} unix:/var/run/openvswitch/${DEVICE}.controller 19 | #set-fail-mode ${DEVICE} secure -- -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.96/guestroot/etc/sysconfig/network-scripts/ifcfg-br1: -------------------------------------------------------------------------------- 1 | DEVICE=br1 2 | ONBOOT=yes 3 | DEVICETYPE=ovs 4 | TYPE=OVSBridge 5 | BOOTPROTO=static 6 | IPADDR=10.50.0.2 7 | NETMASK=255.255.255.0 8 | NETWORK=10.50.0.0 -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.96/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0: -------------------------------------------------------------------------------- 1 | DEVICE=eth0 2 | ONBOOT=yes 3 | DEVICETYPE=ovs 4 | TYPE=OVSPort 5 | OVS_BRIDGE=br0 6 | BOOTPROTO=none 7 | HOTPLUG=no -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.96/guestroot/etc/sysconfig/network-scripts/ifcfg-eth1: -------------------------------------------------------------------------------- 1 | DEVICE=eth1 2 | ONBOOT=yes 3 | TYPE=Ethernet 4 | BOOTPROTO=static 5 | IPADDR=192.168.2.96 6 | NETMASK=255.255.255.0 7 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.96/guestroot/etc/sysconfig/network-scripts/ifcfg-eth2: -------------------------------------------------------------------------------- 1 | DEVICE=eth2 2 | ONBOOT=yes 3 | DEVICETYPE=ovs 4 | TYPE=OVSPort 5 | OVS_BRIDGE=br0 6 | BOOTPROTO=none 7 | HOTPLUG=no 8 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.96/guestroot/etc/sysconfig/network-scripts/route-br0: -------------------------------------------------------------------------------- 1 | 172.16.90.0/24 via 172.16.91.2 dev br0 2 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.96/kill.sh: -------------------------------------------------------------------------------- 1 | ../192.168.2.91/kill.sh -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.96/login.sh: -------------------------------------------------------------------------------- 1 | ../login.sh -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.96/run_cmd.sh: -------------------------------------------------------------------------------- 1 | ../run_cmd.sh -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/192.168.2.96/vmspec.conf: -------------------------------------------------------------------------------- 1 | vm_name="wanedge" 2 | cpu_type=qemu64,+vmx 3 | mem_size=1024 4 | cpu_num=1 5 | vnc_addr= 6 | vnc_port=14106 7 | serial=telnet:127.0.0.1:14206,server,nowait 8 | 9 | containers[0]=vm7 10 | 11 | nics[0]="name=96-eth0 hwaddr=52:54:FF:00:15:11 bridge=vnet-itest0" 12 | nics[1]="name=96-eth1 hwaddr=52:54:FF:00:15:12 bridge=vnet-br0" 13 | nics[2]="name=96-eth2 hwaddr=52:54:FF:00:15:13 bridge=vnet-wanedge" 14 | 15 | container_if[0]="container=vm7 ifname=v7 hwaddr=02:00:00:00:00:07 bridge=br0" 16 | container_if[1]="container=vm7 ifname=m7 hwaddr=52:54:FF:00:00:07 bridge=br1 ip_addr=10.50.0.107" 17 | 18 | IP_ADDR=192.168.2.96 19 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/base/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))/.." && pwd -P)" 4 | export NODE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 5 | TMP_ROOT="${NODE_DIR}/tmp_root" 6 | 7 | 8 | . "${ENV_ROOTDIR}/config.source" 9 | . "${NODE_DIR}/vmspec.conf" 10 | . "${ENV_ROOTDIR}/ind-steps/common.source" 11 | 12 | base=true 13 | 14 | IND_STEPS=( 15 | "box" 16 | "ssh" 17 | "epel" 18 | "lxc" 19 | "sclo-ruby" 20 | "nettools" 21 | "openvswitch" 22 | ) 23 | 24 | initialize 25 | build "${IND_STEPS[@]}" 26 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/base/destroy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))/.." && pwd -P)" 4 | export NODE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 5 | 6 | . "${ENV_ROOTDIR}/config.source" 7 | . "${NODE_DIR}/vmspec.conf" 8 | . "${ENV_ROOTDIR}/ind-steps/step-box/common.source" 9 | 10 | destroy_vm 11 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/base/guestroot/etc/sysconfig/network: -------------------------------------------------------------------------------- 1 | NETWORKING=yes 2 | GATEWAY=192.168.2.1 3 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/base/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0: -------------------------------------------------------------------------------- 1 | DEVICE=eth0 2 | ONBOOT=yes 3 | TYPE=Ethernet 4 | BOOTPROTO=static 5 | IPADDR=192.168.2.90 6 | NETMASK=255.255.255.0 7 | NETWORK=192.168.2.90 8 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/base/guestroot/etc/yum.repos.d/CentOS-Base.repo: -------------------------------------------------------------------------------- 1 | [base] 2 | name=CentOS-$releasever - Base 3 | baseurl=http://ftp.jaist.ac.jp/pub/Linux/CentOS/7/os/$basearch/ 4 | gpgcheck=1 5 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 6 | 7 | [updates] 8 | name=CentOS-$releasever - Updates 9 | baseurl=http://ftp.jaist.ac.jp/pub/Linux/CentOS/7/updates/$basearch/ 10 | gpgcheck=1 11 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 12 | 13 | [extras] 14 | name=CentOS-$releasever - Extras 15 | baseurl=http://ftp.jaist.ac.jp/pub/Linux/CentOS/7/extras/$basearch/ 16 | gpgcheck=1 17 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/base/kill.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))/.." && pwd -P)" 4 | export NODE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 5 | 6 | . "${ENV_ROOTDIR}/config.source" 7 | . "${NODE_DIR}/vmspec.conf" 8 | . "${ENV_ROOTDIR}/ind-steps/step-box/common.source" 9 | 10 | kill_vm 11 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/base/login.sh: -------------------------------------------------------------------------------- 1 | ../login.sh -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/base/vmspec.conf: -------------------------------------------------------------------------------- 1 | vm_name="base" 2 | cpu_type=qemu64,+vmx 3 | mem_size=1024 4 | cpu_num=1 5 | vnc_addr= 6 | vnc_port=12001 7 | serial=telnet:127.0.0.1:13001,server,nowait 8 | 9 | nics[0]="name=onv-base hwaddr=52:56:01:00:05:02 bridge=vnet-br0" 10 | 11 | IP_ADDR=192.168.2.90 12 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/destroy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))" && pwd -P)" 4 | . "${ENV_ROOTDIR}/ind-steps/common.source" 5 | . "${ENV_ROOTDIR}/ind-steps/step-buildenv/common.source" 6 | . "${ENV_ROOTDIR}/config.source" 7 | 8 | scheduled_nodes=${NODES[@]} 9 | [[ -n "$1" ]] && scheduled_nodes="${@}" 10 | 11 | initialize 12 | teardown_environment 13 | teardown_host_settings 14 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/external_libraries/README.md: -------------------------------------------------------------------------------- 1 | All repositories in this directory were added with `git-subtree`. Take some time to familiarize yourself with `git-subtree` before making changes here. [This blog](http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/) is a good place to start. 2 | 3 | The repositories were subtreed from the following locations: 4 | 5 | * bashsteps: https://github.com/axsh/bashsteps 6 | * mount-partition: https://github.com/triggers/mount-partition 7 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/external_libraries/bashsteps/examples/new/simple-defaults-for-bashsteps.source: -------------------------------------------------------------------------------- 1 | ../../simple-defaults-for-bashsteps.source -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/external_libraries/bashsteps/examples/old/simple-defaults-for-bashsteps.source: -------------------------------------------------------------------------------- 1 | ../../simple-defaults-for-bashsteps.source -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/ind-steps/step-box/postconfigure.sh: -------------------------------------------------------------------------------- 1 | run_cmd "iptables -F" 2 | run_cmd "systemctl stop firewalld" 3 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/ind-steps/step-buildenv/boot.sh: -------------------------------------------------------------------------------- 1 | 2 | for node in ${scheduled_nodes[@]} ; do 3 | ( 4 | $starting_group "Building ${node%,*}" 5 | [[ "${node}" == "base" && -f "${CACHE_DIR}/${BRANCH}/box-disk1.raw" ]] 6 | $skip_group_if_unnecessary 7 | "${ENV_ROOTDIR}/${node}/build.sh" 8 | ) ; prev_cmd_failed 9 | done 10 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/ind-steps/step-buildenv/preconfigure.sh: -------------------------------------------------------------------------------- 1 | 2 | $REBUILD && { 3 | rm -rf "${CACHE_DIR}/${BRANCH}" 4 | teardown_environment 5 | } || { 6 | ( 7 | $starting_step "Clone base images from ${BASE_BRANCH}" 8 | [ -d "${CACHE_DIR}/${BRANCH}" -o ! -d "${CACHE_DIR}/${BASE_BRANCH}" ] 9 | $skip_step_if_already_done ; set -ex 10 | cp -r "${CACHE_DIR}/${BASE_BRANCH}" "${CACHE_DIR}/${BRANCH}" 11 | ) ; prev_cmd_failed 12 | } 13 | 14 | ( 15 | $starting_step "Create cache folder" 16 | [ -d "${CACHE_DIR}/${BRANCH}" ] 17 | $skip_step_if_already_done ; set -ex 18 | mkdir -p "${CACHE_DIR}/${BRANCH}" 19 | ) ; prev_cmd_failed 20 | 21 | masquerade "${ip_mng_br0}" 22 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/ind-steps/step-epel/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | install_package "epel-release" 4 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/ind-steps/step-lxc/postconfigure.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ( 4 | $starting_step "Setup LXC" 5 | run_cmd "mount | grep -q cgroup" 6 | $skip_step_if_already_done; set -xe 7 | run_cmd <> /etc/fstab 10 | mount /cgroup 11 | EOS 12 | ) ; prev_cmd_failed 13 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/ind-steps/step-lxc/provide.sh: -------------------------------------------------------------------------------- 1 | # [[ -z ${#containers[@]} ]] || { 2 | # for c in ${containers[@]} ; do 3 | # ( 4 | # $starting_step "Start container: $c" 5 | # run_ssh root@${IP_ADDR} "lxc-info -n $c | grep -q RUNNING" 6 | # $skip_step_if_already_done; set -ex 7 | # run_ssh root@${IP_ADDR} "lxc-start -n $c -d" 8 | # ) ; prev_cmd_failed 9 | # done 10 | # } 11 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/ind-steps/step-mysql/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | install_package "mariadb-server" 4 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/ind-steps/step-mysql/preconfigure.sh: -------------------------------------------------------------------------------- 1 | ( 2 | $starting_step "Disable strict trans tables" 3 | sudo grep -q "STRICT_TRANS_TABLES" ${TMP_ROOT}/etc/my.cnf 4 | [[ $? -eq 1 ]] 5 | $skip_step_if_already_done; set -xe 6 | # Mysql now sets STRIC_TRANS_TABLES by default, this serves as a workaround 7 | run_cmd "sed -i 's,\,STRICT_TRANS_TABLES,,g' /etc/my.cnf" 8 | ) ; prev_cmd_failed 9 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/ind-steps/step-mysql/provide.sh: -------------------------------------------------------------------------------- 1 | start_service "mariadb" 2 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/ind-steps/step-nettools/install.sh: -------------------------------------------------------------------------------- 1 | ( 2 | # Needed for ifconfig which is used by the net-dhcp gem in openvnet 3 | $starting_step "Install Net-tools" 4 | run_cmd "command -v ifconfig" > /dev/null 5 | $skip_step_if_already_done ; set -xe 6 | run_cmd "yum install -y net-tools tcpdump" 7 | ) ; prev_cmd_failed 8 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/ind-steps/step-openvswitch/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ( 4 | $starting_step "Set up OpenVNet third party repo for openvswitch" 5 | [[ -f ${TMP_ROOT}/etc/yum.repos.d/openvnet-third-party.repo ]] 6 | $skip_step_if_already_done; set -xe 7 | sudo chroot ${TMP_ROOT} /bin/bash -c "cat > /etc/yum.repos.d/openvnet-third-party.repo < /dev/null ; do 17 | sleep 5 18 | tries=$(( tries + 1 )) 19 | [[ $tries -eq ${timeout} ]] && exit 255 20 | done 21 | : 22 | ) ; prev_cmd_failed 23 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/ind-steps/step-ssh/common.source: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function add_user_key () { 4 | local user="${1}" 5 | 6 | rm -f ${NODE_DIR}/sshkey 7 | rm -f ${NODE_DIR}/sshkey.pub 8 | ssh-keygen -t rsa -b 2048 -N "" -f ${NODE_DIR}/sshkey 9 | chmod 600 ${NODE_DIR}/sshkey 10 | } 11 | 12 | function install_user_key () { 13 | local user="${1}" 14 | 15 | run_cmd "mkdir -p -m 600 /${user}/.ssh" 16 | sudo cp "${CACHE_DIR}/${BRANCH}/sshkey" "${TMP_ROOT}/${user}/.ssh/id_rsa" 17 | sudo cp "${CACHE_DIR}/${BRANCH}/sshkey.pub" "${TMP_ROOT}/${user}/.ssh/authorized_keys" 18 | } 19 | 20 | ci_user="${user:-root}" 21 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/kill.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))" && pwd -P)" 4 | . "${ENV_ROOTDIR}/ind-steps/common.source" 5 | . "${ENV_ROOTDIR}/ind-steps/step-buildenv/common.source" 6 | . "${ENV_ROOTDIR}/config.source" 7 | 8 | scheduled_nodes=${NODES[@]} 9 | [[ -n "$1" ]] && scheduled_nodes="${@}" 10 | 11 | initialize 12 | teardown_environment $provide 13 | teardown_host_settings 14 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/multibox/run_cmd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))" && pwd -P)" 4 | export NODE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 5 | 6 | node="${1}" 7 | 8 | if [[ "${NODE_DIR}" == "${ENV_ROOTDIR}" ]] ; then 9 | [[ "${node}" == "" ]] && { 10 | echo "Error: missing node name" 11 | exit 1 12 | } 13 | shift ; ${ENV_ROOTDIR}/${node}/run_cmd.sh "${@}" 14 | else 15 | . "${NODE_DIR}/vmspec.conf" 16 | $(sudo kill -0 $(sudo cat "${NODE_DIR}/${vm_name}.pid" 2> /dev/null) 2> /dev/null) || { 17 | echo "Error: node not running" 18 | exit 1 19 | } 20 | 21 | . "${ENV_ROOTDIR}/ind-steps/common.source" 22 | run_cmd "${@}" 23 | fi 24 | -------------------------------------------------------------------------------- /ci/ci.el7/integration_test/run_tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | current_dir=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd) 4 | 5 | ${current_dir}/multibox/build.sh 6 | 7 | . ${current_dir}/../../cache_functions.sh "openvnet-ci/el7/branches/${BRANCH}" 8 | . /etc/profile.d/rvm.sh 9 | 10 | 11 | try_load_cache "/data" "/data" "${COMMIT_ID}" 12 | 13 | rvm use 2.3.0 14 | gem install bundler 15 | cd integration_test 16 | bundle install 17 | 18 | create_cache "/data" "/data" "${COMMIT_ID}" "${current_dir}/build-cache.list" 19 | 20 | set -xe 21 | 22 | RELEASE_VERSION="el7" bin/itest-spec run 23 | -------------------------------------------------------------------------------- /ci/ci.el7/rspec_rpmbuild/build-cache.list: -------------------------------------------------------------------------------- 1 | var/tmp/rpmbuild/SOURCES/openvnet/vnet/vendor 2 | var/tmp/rpmbuild/SOURCES/openvnet/client/vnctl/vendor 3 | var/tmp/openvnet/vnet/vendor -------------------------------------------------------------------------------- /ci/ci.el7/rspec_rpmbuild/conf_files/etc/openvnet/vnctl-ruby: -------------------------------------------------------------------------------- 1 | # . scl_source enable is written by rpmbuild. 2 | -------------------------------------------------------------------------------- /ci/ci.el7/rspec_rpmbuild/conf_files/etc/openvnet/vnctl.conf: -------------------------------------------------------------------------------- 1 | # webapi_protocol 'http' 2 | # webapi_uri '127.0.0.1' 3 | # webapi_port '9090' 4 | # webapi_version '1.0' 5 | # output_format 'yml' 6 | -------------------------------------------------------------------------------- /ci/ci.el7/rspec_rpmbuild/conf_files/etc/sysconfig/openvnet: -------------------------------------------------------------------------------- 1 | # OpenVNet common variables 2 | VNET_ROOT=/opt/axsh/openvnet 3 | LOG_DIRECTORY=/var/log/openvnet/ 4 | -------------------------------------------------------------------------------- /ci/ci.el7/rspec_rpmbuild/conf_files/etc/systemd/system/vnet-webapi.service.d/env.conf: -------------------------------------------------------------------------------- 1 | [Service] 2 | #Environment=BIND_ADDR=127.0.0.1 PORT=9090 RACK_ENV=production -------------------------------------------------------------------------------- /ci/ci.el7/rspec_rpmbuild/conf_files/usr/bin/vnctl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | vnctl_path="/opt/axsh/openvnet/client/vnctl/bin/vnctl" 4 | 5 | [ -f /etc/openvnet/vnctl-ruby ] && . /etc/openvnet/vnctl-ruby 6 | 7 | set -e 8 | $vnctl_path "$@" 9 | -------------------------------------------------------------------------------- /ci/ci.el7/rspec_rpmbuild/conf_files/usr/lib/systemd/system/vnet-redis-monitor.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=OpenVNet Redis monitor process 3 | After=network.target 4 | 5 | [Service] 6 | EnvironmentFile=/etc/sysconfig/openvnet 7 | User=vnet-redis-monitor 8 | SyslogIdentifier=vnet-redis-monitor 9 | WorkingDirectory=/opt/axsh/openvnet/vnet 10 | ExecStart=/usr/bin/scl enable ${SCL_RUBY} -- bundle exec ./bin/redis-monitor >> ${LOG_DIRECTORY}/redis-monitor.log 11 | 12 | [Install] 13 | WantedBy=multi-user.target 14 | -------------------------------------------------------------------------------- /ci/ci.el7/rspec_rpmbuild/conf_files/usr/lib/systemd/system/vnet-vna.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=OpenVNet agent process 3 | After=network.target 4 | 5 | [Service] 6 | EnvironmentFile=/etc/sysconfig/openvnet 7 | SyslogIdentifier=vnet-vna 8 | WorkingDirectory=/opt/axsh/openvnet/vnet 9 | ExecStart=/usr/bin/scl enable ${SCL_RUBY} -- bundle exec ./bin/vna >> ${LOG_DIRECTORY}/vna.log 10 | 11 | [Install] 12 | WantedBy=multi-user.target 13 | -------------------------------------------------------------------------------- /ci/ci.el7/rspec_rpmbuild/conf_files/usr/lib/systemd/system/vnet-vnmgr.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=OpenVNet management process 3 | After=network.target 4 | 5 | [Service] 6 | EnvironmentFile=/etc/sysconfig/openvnet 7 | User=vnet-vnmgr 8 | SyslogIdentifier=vnet-vnmgr 9 | WorkingDirectory=/opt/axsh/openvnet/vnet 10 | ExecStart=/usr/bin/scl enable ${SCL_RUBY} -- bundle exec ./bin/vnmgr >> ${LOG_DIRECTORY}/vnmgr.log 11 | 12 | [Install] 13 | WantedBy=multi-user.target 14 | -------------------------------------------------------------------------------- /ci/ci.el7/rspec_rpmbuild/conf_files/usr/lib/systemd/system/vnet-webapi.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=OpenVNet REST API process 3 | After=network.target 4 | 5 | [Service] 6 | EnvironmentFile=/etc/sysconfig/openvnet 7 | Environment=BIND_ADDR=0.0.0.0 PORT=9090 RACK_ENV=production 8 | User=vnet-webapi 9 | SyslogIdentifier=vnet-webapi 10 | WorkingDirectory=/opt/axsh/openvnet/vnet 11 | ExecStart=/usr/bin/scl enable ${SCL_RUBY} -- bundle exec unicorn -o ${BIND_ADDR} -p ${PORT} ./rack/config-webapi.ru >> ${LOG_DIRECTORY}/webapi.log 12 | 13 | [Install] 14 | WantedBy=multi-user.target 15 | -------------------------------------------------------------------------------- /ci/ci.el7/rspec_rpmbuild/fastestmirror.conf: -------------------------------------------------------------------------------- 1 | [main] 2 | enabled=1 3 | verbose=0 4 | always_print_best_host = true 5 | socket_timeout=3 6 | # Relative paths are relative to the cachedir (and so works for users as well 7 | # as root). 8 | hostfilepath=timedhosts.txt 9 | maxhostfileage=10 10 | maxthreads=15 11 | #exclude=.gov, facebook 12 | #include_only=.nl,.de,.uk,.ie 13 | include_only=.jp 14 | -------------------------------------------------------------------------------- /ci/ci.el7/rspec_rpmbuild/packages.d/third_party/openvnet-openvswitch/el6.versions: -------------------------------------------------------------------------------- 1 | 2.3.3 2 | 2.4.1 3 | -------------------------------------------------------------------------------- /ci/ci.el7/rspec_rpmbuild/packages.d/third_party/openvnet-openvswitch/el7.versions: -------------------------------------------------------------------------------- 1 | 2.3.3 2 | 2.4.1 3 | 2.5.1 4 | -------------------------------------------------------------------------------- /ci/ci.el7/rspec_rpmbuild/yum.repo/dev.repo: -------------------------------------------------------------------------------- 1 | [openvnet] 2 | name=OpenVNet Repo - CI 3 | baseurl=https://ci.openvnet.org/repos/$branch/packages/rhel/$releasever/vnet/$ovn_release_suffix/ 4 | enabled=1 5 | gpgcheck=0 6 | 7 | [openvnet-third-party] 8 | name=OpenVNet Third Party Repo - CI 9 | baseurl=https://ci.openvnet.org/repos/packages/rhel/$releasever/third_party/current/ 10 | enabled=1 11 | gpgcheck=0 12 | -------------------------------------------------------------------------------- /ci/garbage_collection/garbage_collection_misc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | function remove_dir { 5 | dir_to_rm=$1 6 | 7 | ## "master" and "develop" dirs. should NEVER be removed 8 | ## "packages" are built separately when new versions are released and should thereore be left. 9 | short_name=${dir_to_rm%/} # Remove any trailing '/' 10 | short_name=${short_name##*/} # Remove everything up to and including the last '/' 11 | for no_rm in "master" "develop" "packages"; do 12 | if [[ "${short_name}" = "${no_rm}" ]]; then 13 | echo "Cannot remove \"${no_rm}\". Ignoring." 14 | return 0 15 | fi 16 | done 17 | 18 | echo "rm -rf ${dir_to_rm}" 19 | rm -rf ${dir_to_rm} 20 | 21 | } 22 | 23 | 24 | -------------------------------------------------------------------------------- /ci/gen-dev-build-tag.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Show release tag for development build. "20160919093435gitb064bb7" 3 | timestamp=$(date --date="$(git show -s --format=%cd --date=iso HEAD)" +%Y%m%d%H%M%S) 4 | echo "${timestamp}git$(git rev-parse --short HEAD)" 5 | -------------------------------------------------------------------------------- /client/ruby/lib/vnet_api_client.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | require 'net/http' 4 | require 'json' 5 | 6 | require_relative 'vnet_api_client/api_resource' 7 | require_relative 'vnet_api_client/api_resources' 8 | require_relative 'vnet_api_client/response_format' 9 | 10 | module VNetAPIClient 11 | def self.uri=(u) 12 | ApiResource.api_uri = u 13 | end 14 | 15 | def self.version=(v) 16 | ApiResource.api_version = v 17 | end 18 | 19 | def self.format=(f) 20 | ApiResource.api_format = f 21 | end 22 | end 23 | 24 | # Set default values 25 | VNetAPIClient.uri = 'http://localhost:9090' 26 | VNetAPIClient.format = :json 27 | -------------------------------------------------------------------------------- /client/ruby/lib/vnet_api_client/response_format.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module VNetAPIClient 4 | module ResponseFormats 5 | 6 | def self.[](format) 7 | case format 8 | when :json 9 | Json.new 10 | else 11 | raise "Unknown response format: #{format}" 12 | end 13 | end 14 | 15 | class Format 16 | def parse(response) 17 | raise NotImplementedError 18 | end 19 | end 20 | 21 | class Json < Format 22 | def parse(response) 23 | JSON.parse(response.body) if response.body 24 | end 25 | end 26 | 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /client/ruby/vnet_api_client.gemspec: -------------------------------------------------------------------------------- 1 | Gem::Specification.new do |s| 2 | s.name = 'vnet_api_client' 3 | s.version = '0.9' 4 | s.date = '2016-04-19' 5 | s.summary = 'Ruby wrapper for OpenVNet\'s RESTful API' 6 | s.authors = ['Axsh Co. LTD'] 7 | s.email = 'dev@axsh.net' 8 | s.files = Dir.glob("{lib}/**/*") + %w(README.md) 9 | s.homepage = 'http://openvnet.org' 10 | s.license = 'LGPL-3.0' 11 | end 12 | -------------------------------------------------------------------------------- /client/vnctl/.gitignore: -------------------------------------------------------------------------------- 1 | vendor 2 | .bundle 3 | -------------------------------------------------------------------------------- /client/vnctl/Gemfile: -------------------------------------------------------------------------------- 1 | source 'http://rubygems.org' 2 | 3 | gem 'thor' 4 | gem 'fuguta' 5 | -------------------------------------------------------------------------------- /client/vnctl/Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: http://rubygems.org/ 3 | specs: 4 | fuguta (1.0.4.1) 5 | thor (0.20.0) 6 | 7 | PLATFORMS 8 | ruby 9 | 10 | DEPENDENCIES 11 | fuguta 12 | thor 13 | 14 | BUNDLED WITH 15 | 1.10.6 16 | -------------------------------------------------------------------------------- /client/vnctl/lib/vnctl/cli/ip_lease_container.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnctl::Cli 4 | class IpLeaseContainer < Base 5 | namespace :ip_lease_containers 6 | api_suffix 'ip_lease_containers' 7 | 8 | define_standard_crud_commands 9 | 10 | desc "ip_leases UUID", "Shows the ip leases of a specific lease container." 11 | def ip_leases(uuid) 12 | puts Vnctl.webapi.get("#{suffix}/#{uuid}/ip_leases") 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /client/vnctl/lib/vnctl/cli/ip_retention_container.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnctl::Cli 4 | class IpRetentionContainer < Base 5 | namespace :ip_retention_containers 6 | api_suffix "ip_retention_containers" 7 | 8 | add_modify_shared_options { 9 | option :lease_time, type: :numeric, desc: "The lease time for ip retentions this container." 10 | option :grace_time, type: :numeric, desc: "The grace time for ip retentions in this container." 11 | } 12 | 13 | define_standard_crud_commands 14 | 15 | desc "ip_retentions UUID", "Shows the ip retentions of a specific retention container." 16 | def ip_retentions(uuid) 17 | puts Vnctl.webapi.get("#{suffix}/#{uuid}/ip_retentions") 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /client/vnctl/lib/vnctl/cli/mac_lease.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnctl::Cli 4 | class MacLease < Base 5 | namespace :mac_leases 6 | api_suffix "mac_leases" 7 | 8 | add_modify_shared_options { 9 | option_uuid 10 | option :interface_uuid, :type => :string, :desc => "The uuid of the interface that this mac lease is tied to." 11 | option :mac_address, :type => :string, :desc => "The mac address to lease" 12 | option :segment_uuid, :type => :string, :desc => "The uuid of the segment." 13 | } 14 | set_required_options [:mac_address, :interface_uuid] 15 | 16 | define_standard_crud_commands 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /client/vnctl/lib/vnctl/cli/route_link.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnctl::Cli 4 | class RouteLink < Base 5 | namespace :route_links 6 | api_suffix "route_links" 7 | 8 | add_shared_options { 9 | option :topology_uuid, :type => :string, :desc => "The uuid of the topology this network is in." 10 | } 11 | 12 | add_modify_shared_options { 13 | option :mac_address, :type => :string, :required => false, 14 | :desc => "The mac address for this route link." 15 | } 16 | 17 | define_standard_crud_commands 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /client/vnctl/lib/vnctl/cli/segment.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnctl::Cli 4 | class Segment < Base 5 | namespace :segments 6 | api_suffix 'segments' 7 | 8 | add_shared_options { 9 | option :topology_uuid, :type => :string, :desc => "The uuid of the topology this network is in." 10 | option :mode, type: :string, required: true, desc: 'Can be either physical or virtual.' 11 | } 12 | 13 | option_uuid 14 | add_shared_options 15 | define_add 16 | 17 | define_show 18 | define_del 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /client/vnctl/lib/vnctl/configuration/vnctl.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnctl::Configuration 4 | class Vnctl < Fuguta::Configuration 5 | param :webapi_protocol, :default => 'http' 6 | param :webapi_uri, :default => '127.0.0.1' 7 | param :webapi_port, :default => 9090 8 | param :webapi_version, :default => '1.0' 9 | param :output_format, :default => 'yml' 10 | 11 | def validate(errors) 12 | output_formats = ['yml', 'json'] 13 | unless output_formats.member?(output_format) 14 | errors << "\"%s\" is not a valid output_format. Must be one of %s" % 15 | [output_format, output_formats.inspect] 16 | end 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /deployment/conf_files/etc/default/openvnet: -------------------------------------------------------------------------------- 1 | # OpenVNet common variables 2 | VNET_ROOT=/opt/axsh/openvnet 3 | RUBY_PATH=/opt/axsh/openvnet/ruby/bin 4 | PATH=${RUBY_PATH}:$PATH 5 | LOG_DIRECTORY=/var/log/openvnet/ 6 | -------------------------------------------------------------------------------- /deployment/conf_files/etc/default/vnet-vna: -------------------------------------------------------------------------------- 1 | [ -f /etc/default/openvnet ] && . /etc/default/openvnet 2 | -------------------------------------------------------------------------------- /deployment/conf_files/etc/default/vnet-vnmgr: -------------------------------------------------------------------------------- 1 | [ -f /etc/default/openvnet ] && . /etc/default/openvnet 2 | VNET_USER=vnet-vnmgr 3 | -------------------------------------------------------------------------------- /deployment/conf_files/etc/default/vnet-webapi: -------------------------------------------------------------------------------- 1 | [ -f /etc/default/openvnet ] && . /etc/default/openvnet 2 | BIND_ADDR=0.0.0.0 3 | PORT=9090 4 | RACK_ENV=production 5 | VNET_USER=vnet-webapi 6 | -------------------------------------------------------------------------------- /deployment/conf_files/etc/init/vnet-vna.conf: -------------------------------------------------------------------------------- 1 | description "OpenVNet: Database agent" 2 | author "axsh Co." 3 | 4 | respawn 5 | respawn limit 5 60 6 | 7 | ## agent name 8 | env NAME=vna 9 | 10 | script 11 | [ -f /etc/default/vnet-${NAME} ] && . /etc/default/vnet-${NAME} 12 | export LOG_DIRECTORY 13 | 14 | [ -d "${LOG_DIRECTORY}" ] || { 15 | mkdir ${LOG_DIRECTORY} 16 | } 17 | 18 | [ -d "${VNET_ROOT}" ] || { 19 | logger "no such directory: ${VNET_ROOT}" 20 | exit 1 21 | } 22 | cd ${VNET_ROOT}/vnet/ 23 | 24 | exec bundle exec ./bin/${NAME} \ 25 | >> ${LOG_DIRECTORY}/${NAME}.log 2>&1 26 | end script 27 | -------------------------------------------------------------------------------- /deployment/conf_files/etc/init/vnet-vnmgr.conf: -------------------------------------------------------------------------------- 1 | description "OpenVNet: Database agent" 2 | author "axsh Co." 3 | 4 | respawn 5 | respawn limit 5 60 6 | 7 | ## agent name 8 | env NAME=vnmgr 9 | 10 | script 11 | ## Uncomment next 2 lines to enable logging of this upstart script 12 | #exec 2>>/var/log/openvnet/vnmgr-upstart.log 13 | #set -x 14 | 15 | [ -f /etc/default/vnet-${NAME} ] && . /etc/default/vnet-${NAME} 16 | export LOG_DIRECTORY 17 | 18 | [ -d "${VNET_ROOT}" ] || { 19 | logger "no such directory: ${VNET_ROOT}" 20 | exit 1 21 | } 22 | cd ${VNET_ROOT}/vnet/ 23 | 24 | su ${VNET_USER} -s /bin/sh -c "exec bundle exec ./bin/${NAME}" >> ${LOG_DIRECTORY}/${NAME}.log 2>&1 25 | end script 26 | -------------------------------------------------------------------------------- /deployment/conf_files/etc/openvnet/vnctl.conf: -------------------------------------------------------------------------------- 1 | # webapi_protocol 'http' 2 | # webapi_uri '127.0.0.1' 3 | # webapi_port '9090' 4 | # webapi_version '1.0' 5 | # output_format 'yml' 6 | -------------------------------------------------------------------------------- /deployment/conf_files/usr/bin/vnctl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | static_ruby_path="/opt/axsh/openvnet/ruby/bin/ruby" 5 | vnctl_path="/opt/axsh/openvnet/client/vnctl/bin/vnctl" 6 | 7 | if [ -x $static_ruby_path ]; then 8 | $static_ruby_path $vnctl_path "$@" 9 | else 10 | $vnctl_path "$@" 11 | fi 12 | -------------------------------------------------------------------------------- /deployment/yum_repositories/development/openvnet-third-party.repo: -------------------------------------------------------------------------------- 1 | [openvnet-third-party] 2 | name=OpenVNet Third Party 3 | baseurl=http://dlc.openvnet.axsh.jp/packages/rhel/6/third_party/current/ 4 | enabled=1 5 | gpgcheck=0 6 | 7 | -------------------------------------------------------------------------------- /deployment/yum_repositories/development/openvnet.repo: -------------------------------------------------------------------------------- 1 | [openvnet] 2 | name=OpenVNet 3 | baseurl=http://dlc.openvnet.axsh.jp/packages/rhel/6/vnet/develop/current/ 4 | enabled=1 5 | gpgcheck=0 6 | -------------------------------------------------------------------------------- /deployment/yum_repositories/stable/openvnet-third-party.repo: -------------------------------------------------------------------------------- 1 | [openvnet-third-party] 2 | name=OpenVNet Third Party 3 | baseurl=http://dlc.openvnet.axsh.jp/packages/rhel/6/third_party/current/ 4 | enabled=1 5 | gpgcheck=0 6 | 7 | -------------------------------------------------------------------------------- /deployment/yum_repositories/stable/openvnet.repo: -------------------------------------------------------------------------------- 1 | [openvnet] 2 | name=OpenVNet 3 | baseurl=http://dlc.openvnet.axsh.jp/packages/rhel/6/vnet/current/ 4 | enabled=1 5 | gpgcheck=0 6 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | site 2 | site/* 3 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | Documentation can be found in Markdown format in the [content](content/) folder. 2 | 3 | Documents are used to generate static website using [mkdocs](https://github.com/mkdocs/mkdocs) 4 | -------------------------------------------------------------------------------- /docs/content/creating-virtual-networks/img/images.odg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axsh/openvnet/1407ad799ab825f9b2bce20d60326f3afc1222ec/docs/content/creating-virtual-networks/img/images.odg -------------------------------------------------------------------------------- /docs/content/creating-virtual-networks/img/single-network-dhcp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axsh/openvnet/1407ad799ab825f9b2bce20d60326f3afc1222ec/docs/content/creating-virtual-networks/img/single-network-dhcp.png -------------------------------------------------------------------------------- /docs/content/creating-virtual-networks/img/single-network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axsh/openvnet/1407ad799ab825f9b2bce20d60326f3afc1222ec/docs/content/creating-virtual-networks/img/single-network.png -------------------------------------------------------------------------------- /docs/content/creating-virtual-networks/img/two-networks-router.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axsh/openvnet/1407ad799ab825f9b2bce20d60326f3afc1222ec/docs/content/creating-virtual-networks/img/two-networks-router.png -------------------------------------------------------------------------------- /docs/content/creating-virtual-networks/img/two-networks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axsh/openvnet/1407ad799ab825f9b2bce20d60326f3afc1222ec/docs/content/creating-virtual-networks/img/two-networks.png -------------------------------------------------------------------------------- /docs/content/custom.css: -------------------------------------------------------------------------------- 1 | .wy-side-nav-search { 2 | background-color:#4A2188; 3 | } 4 | -------------------------------------------------------------------------------- /docs/content/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axsh/openvnet/1407ad799ab825f9b2bce20d60326f3afc1222ec/docs/content/favicon.png -------------------------------------------------------------------------------- /docs/content/img/OpenVNet_logo_single.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axsh/openvnet/1407ad799ab825f9b2bce20d60326f3afc1222ec/docs/content/img/OpenVNet_logo_single.png -------------------------------------------------------------------------------- /docs/content/img/all-in-one-host.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axsh/openvnet/1407ad799ab825f9b2bce20d60326f3afc1222ec/docs/content/img/all-in-one-host.png -------------------------------------------------------------------------------- /docs/content/img/axsh-logo_fullcolor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axsh/openvnet/1407ad799ab825f9b2bce20d60326f3afc1222ec/docs/content/img/axsh-logo_fullcolor.png -------------------------------------------------------------------------------- /docs/content/img/concept_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axsh/openvnet/1407ad799ab825f9b2bce20d60326f3afc1222ec/docs/content/img/concept_1.png -------------------------------------------------------------------------------- /docs/content/img/concept_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axsh/openvnet/1407ad799ab825f9b2bce20d60326f3afc1222ec/docs/content/img/concept_2.png -------------------------------------------------------------------------------- /docs/content/img/images.odg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axsh/openvnet/1407ad799ab825f9b2bce20d60326f3afc1222ec/docs/content/img/images.odg -------------------------------------------------------------------------------- /docs/content/img/installation-environment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axsh/openvnet/1407ad799ab825f9b2bce20d60326f3afc1222ec/docs/content/img/installation-environment.png -------------------------------------------------------------------------------- /integration_test/.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | *.swo 3 | .bundle 4 | vendor 5 | tmp 6 | .ruby-version 7 | log/* 8 | !.gitkeep 9 | -------------------------------------------------------------------------------- /integration_test/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem "rspec" 4 | gem "rake" 5 | gem "net-ssh" 6 | gem "net-ssh-multi" 7 | gem "net-scp" 8 | gem "faraday" 9 | gem "faraday_middleware" 10 | gem "ipaddress" 11 | gem "parallel" 12 | gem "pry-nav" 13 | -------------------------------------------------------------------------------- /integration_test/README.md: -------------------------------------------------------------------------------- 1 | Integration Tests 2 | ================= 3 | 4 | OpenVNet provides a set of integration tests that can be run on virtual machines. To deploy the test environment follow the instructions on the page below. 5 | 6 | * https://github.com/axsh/wakame-ci-cluster/blob/master/kvm-guests/90-vteskins/README.md 7 | -------------------------------------------------------------------------------- /integration_test/bin/dev-spec: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | VNSPEC_ENV=dev $(dirname ${BASH_SOURCE[0]})/vnspec $* 4 | -------------------------------------------------------------------------------- /integration_test/bin/itest-spec: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RELEASE_VERSION="${RELEASE_VERSION:-el6}" 3 | VNSPEC_ENV=itest $(dirname ${BASH_SOURCE[0]})/vnspec $* 4 | -------------------------------------------------------------------------------- /integration_test/bin/vnspec: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # -*- coding: utf-8 -*- 3 | require 'bundler/setup' 4 | $LOAD_PATH << File.expand_path("../lib", File.dirname(__FILE__)) 5 | require 'vnspec' 6 | 7 | invoker = Vnspec::Invoker.new 8 | args = ARGV 9 | args << "run" if args.empty? 10 | invoker.invoke(*args).tap do |success| 11 | puts 12 | if success 13 | puts "result: success" 14 | else 15 | puts "result: failure" 16 | exit 1 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /integration_test/dataset/base_dp.yml: -------------------------------------------------------------------------------- 1 | datapath_segments: 2 | 3 | datapath_networks: 4 | 5 | - datapath_uuid: dp-1 6 | network_uuid: nw-public1 7 | interface_uuid: if-dp1eth0 8 | mac_address: "02:00:01:aa:01:01" 9 | 10 | - datapath_uuid: dp-2 11 | network_uuid: nw-public1 12 | interface_uuid: if-dp2eth0 13 | mac_address: "02:00:01:bb:01:01" 14 | 15 | - datapath_uuid: dp-3 16 | network_uuid: nw-public2 17 | interface_uuid: if-dp3eth0 18 | mac_address: "02:00:01:cc:01:01" 19 | -------------------------------------------------------------------------------- /integration_test/lib/ext/erb.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | class ERB 3 | def result_hash(hash) 4 | b = binding 5 | eval(hash.collect{|k,v| "#{k} = hash[#{k.inspect}];" }.join, b) 6 | result b 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /integration_test/lib/ext/hash.rb: -------------------------------------------------------------------------------- 1 | class Hash 2 | def symbolize_keys 3 | inject({}) do |options, (key, value)| 4 | value = case value 5 | when Array 6 | value.map{|v| v.is_a?(Hash) ? v.symbolize_keys : v } 7 | when Hash 8 | value.symbolize_keys 9 | else 10 | value 11 | end 12 | options[(key.to_sym rescue key) || key] = value 13 | options 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /integration_test/lib/vnspec/.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --backtrace 3 | -------------------------------------------------------------------------------- /integration_test/lib/vnspec/api.rb: -------------------------------------------------------------------------------- 1 | module Vnspec 2 | module API 3 | module ModuleMethods 4 | include Logger 5 | include Config 6 | 7 | def request(*args, &block) 8 | @api ||= api_for(config[:api_adapter]) 9 | @api.request(*args, &block) 10 | end 11 | 12 | def api_for(method) 13 | case method 14 | when :vnctl 15 | Vnctl.new 16 | when :faraday 17 | Faraday.new 18 | else 19 | raise "undefined api method: #{method}" 20 | end 21 | end 22 | end 23 | extend ModuleMethods 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /integration_test/lib/vnspec/api/base.rb: -------------------------------------------------------------------------------- 1 | module Vnspec 2 | module API 3 | class Base 4 | include Logger 5 | include Config 6 | include SSH 7 | 8 | def request(method, url, params = {}, headers = {}, &block) 9 | raise NotImplementedError 10 | end 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /integration_test/lib/vnspec/spec.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | module Vnspec 3 | class SPec 4 | class << self 5 | include SSH 6 | include Logger 7 | include Config 8 | 9 | def exec(name = nil) 10 | spec_file = name ? "spec/#{name}_spec.rb" : "" 11 | 12 | system("cd #{File.expand_path(File.dirname(__FILE__))}; bundle exec rspec #{spec_file}") 13 | end 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /integration_test/lib/vnspec/spec/promiscuous_seg_of_spec.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | require_relative 'spec_helper' 4 | require_relative 'shared_examples/promiscuous.rb' 5 | 6 | describe 'promiscuous_seg_of', :vms_enable_vm => :vm1_5_7, :vms_disable_dhcp => true do 7 | let(:ping_tries) { 10 } 8 | 9 | include_examples 'promiscuous segment examples', pending_local: true 10 | end 11 | -------------------------------------------------------------------------------- /integration_test/lib/vnspec/spec/promiscuous_seg_ovs_spec.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | require_relative 'spec_helper' 4 | require_relative 'shared_examples/promiscuous.rb' 5 | 6 | describe 'promiscuous_seg_ovs', :vms_enable_vm => :vm1_5_7, :vms_disable_dhcp => true do 7 | let(:ping_tries) { 10 } 8 | 9 | include_examples 'promiscuous segment examples', pending_local: true 10 | end 11 | -------------------------------------------------------------------------------- /integration_test/lib/vnspec/spec/router_v2v_spec.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | require_relative 'spec_helper' 4 | require_relative 'shared_examples/router.rb' 5 | 6 | describe 'router_v2v' do 7 | include_examples 'router examples' 8 | end 9 | -------------------------------------------------------------------------------- /integration_test/lib/vnspec/spec/router_v2v_tp_spec.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | require_relative 'spec_helper' 4 | require_relative 'shared_examples/router.rb' 5 | 6 | describe 'router_v2v_tp' do 7 | include_examples 'router examples' 8 | 9 | # Since no vm's do dhcp requests there is nothing to ensure that 10 | # the vna's have properly loaded the segments and other 11 | # information. 12 | sleep 40 13 | end 14 | -------------------------------------------------------------------------------- /integration_test/lib/vnspec/spec/shared_examples/promiscuous.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | require_relative 'wanedge' 4 | 5 | shared_examples 'promiscuous segment examples' do 6 | before(:all) do 7 | vm1.change_ipv4_address('10.210.0.10') 8 | vm7.change_ipv4_address('10.210.0.17') 9 | 10 | vm1.route_default_via(config[:physical_network_gw_ip]) 11 | vm7.route_default_via(config[:physical_network_gw_ip]) 12 | end 13 | 14 | include_examples 'wanedge examples', 'seg-global', pending_local: true, pending_gre: true 15 | end 16 | -------------------------------------------------------------------------------- /integration_test/lib/vnspec/spec/simple_nw_spec.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | require_relative 'spec_helper' 4 | require_relative 'shared_examples/simple' 5 | 6 | describe 'simple_nw' do 7 | include_examples 'simple examples' 8 | end 9 | -------------------------------------------------------------------------------- /integration_test/lib/vnspec/spec/simple_nw_tp_spec.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | require_relative 'spec_helper' 4 | require_relative 'shared_examples/simple' 5 | 6 | describe 'simple_nw_tp' do 7 | include_examples 'simple examples' 8 | end 9 | -------------------------------------------------------------------------------- /integration_test/lib/vnspec/spec/simple_seg_spec.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | require_relative 'spec_helper' 4 | require_relative 'shared_examples/simple' 5 | 6 | describe 'simple_seg', :vms_disable_dhcp => true do 7 | before(:all) do 8 | vm1.change_ipv4_address('10.101.0.10') 9 | vm2.change_ipv4_address('10.101.0.10') 10 | vm3.change_ipv4_address('10.101.0.11') 11 | vm4.change_ipv4_address('10.101.0.11') 12 | vm5.change_ipv4_address('10.101.0.12') 13 | vm6.change_ipv4_address('10.101.0.12') 14 | 15 | # Since no vm's do dhcp requests there is nothing to ensure that 16 | # the vna's have properly loaded the segments and other 17 | # information. 18 | sleep 30 19 | end 20 | 21 | include_examples 'simple examples' 22 | end 23 | -------------------------------------------------------------------------------- /integration_test/lib/vnspec/spec/simple_seg_tp_spec.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | require_relative 'spec_helper' 4 | require_relative 'shared_examples/simple' 5 | 6 | describe 'simple_seg_tp', :vms_disable_dhcp => true do 7 | before(:all) do 8 | vm1.change_ipv4_address('10.101.0.10') 9 | vm2.change_ipv4_address('10.101.0.10') 10 | vm3.change_ipv4_address('10.101.0.11') 11 | vm4.change_ipv4_address('10.101.0.11') 12 | vm5.change_ipv4_address('10.101.0.12') 13 | vm6.change_ipv4_address('10.101.0.12') 14 | 15 | # Since no vm's do dhcp requests there is nothing to ensure that 16 | # the vna's have properly loaded the segments and other 17 | # information. 18 | sleep 30 19 | end 20 | 21 | include_examples 'simple examples' 22 | end 23 | -------------------------------------------------------------------------------- /integration_test/lib/vnspec/spec/support/legacy.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | def legacy 4 | Vnspec::Legacy 5 | end 6 | 7 | def setup_legacy_machine 8 | legacy.setup 9 | end 10 | 11 | [:legacy1, :legacy_esxi].each do |name| 12 | define_method(name) do 13 | legacy[name] 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /integration_test/lib/vnspec/spec/support/vm.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | def vms 4 | Vnspec::VM 5 | end 6 | 7 | def setup_vm 8 | vms.setup 9 | end 10 | 11 | (1..7).map{|i| "vm#{i}".to_sym }.each do |name| 12 | define_method(name) do 13 | vms[name] 14 | end 15 | end 16 | 17 | -------------------------------------------------------------------------------- /integration_test/lib/vnspec/spec/wanedge_spec.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | require_relative 'spec_helper' 4 | require_relative 'shared_examples/wanedge.rb' 5 | 6 | # TODO: Add multiple networks and use all vm's. 7 | 8 | describe 'wanedge', :vms_enable_vm => :vm_1_5_7 do 9 | let(:ping_tries) { 5 } 10 | 11 | include_examples 'wanedge examples', 'nw-global', pending_gre: true 12 | end 13 | -------------------------------------------------------------------------------- /integration_test/lib/vnspec/spec/wanedge_tp_spec.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | require_relative 'spec_helper' 4 | require_relative 'shared_examples/wanedge.rb' 5 | 6 | # TODO: Add multiple networks and use all vm's. 7 | 8 | describe 'wanedge_tp', :vms_enable_vm => :vm_1_5_7 do 9 | let(:ping_tries) { 5 } 10 | 11 | include_examples 'wanedge examples', 'nw-global', pending_gre: true 12 | end 13 | -------------------------------------------------------------------------------- /integration_test/log/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axsh/openvnet/1407ad799ab825f9b2bce20d60326f3afc1222ec/integration_test/log/.gitkeep -------------------------------------------------------------------------------- /vnet/.gitignore: -------------------------------------------------------------------------------- 1 | coverage 2 | vendor 3 | .bundle 4 | -------------------------------------------------------------------------------- /vnet/.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --format documentation 3 | --backtrace 4 | -------------------------------------------------------------------------------- /vnet/bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # -*- coding: utf-8 -*- 3 | 4 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) 5 | 6 | require 'rubygems' 7 | require 'bundler/setup' 8 | require 'dcell' 9 | require 'vnet/api_rpc' 10 | #require 'vnet/api_direct' 11 | require 'pry' 12 | 13 | # TODO: Add direct api proxy option, which makes sure vnmgr is not running. 14 | 15 | conf = Vnet::Configurations::Vna.conf 16 | 17 | # Vnet::Initializers::DB.run(conf.db_uri) 18 | 19 | DCell.start :registry => { 20 | :adapter => conf.registry.adapter, 21 | :host => conf.registry.host, 22 | :port => conf.registry.port 23 | } 24 | 25 | $0 = 'pry' 26 | Pry::CLI.parse_options 27 | -------------------------------------------------------------------------------- /vnet/bin/redis-monitor: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # -*- coding: utf-8 -*- 3 | 4 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) 5 | 6 | require 'rubygems' 7 | require 'bundler/setup' 8 | require 'vnet' 9 | 10 | conf = Vnet::Configurations::Vna.conf 11 | 12 | if conf.registry.adapter.to_s != 'redis' 13 | puts "only 'redis' registry adapter supported: #{conf.registry.adapter}" 14 | exit -1 15 | end 16 | 17 | Kernel.system("redis-cli -h #{conf.registry.host} -p #{conf.registry.port} MONITOR") 18 | -------------------------------------------------------------------------------- /vnet/db/migrations/0007_mode_only.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | Sequel.migration do 4 | up do 5 | rename_column :network_services, :type, :mode 6 | rename_column :routes, :route_type, :mode 7 | end 8 | 9 | down do 10 | rename_column :network_services, :mode, :type 11 | rename_column :routes, :mode, :route_type 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /vnet/db/migrations/0008_dp_nwrl_not_null.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | Sequel.migration do 4 | up do 5 | alter_table(:datapath_networks) do 6 | set_column_not_null :mac_address_id 7 | end 8 | 9 | alter_table(:datapath_route_links) do 10 | set_column_not_null :mac_address_id 11 | end 12 | end 13 | 14 | down do 15 | alter_table(:datapath_networks) do 16 | set_column_allow_null :mac_address_id 17 | end 18 | 19 | alter_table(:datapath_route_links) do 20 | set_column_allow_null :mac_address_id 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /vnet/db/migrations/0012_remove_vnetedge.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | Sequel.migration do 4 | up do 5 | drop_table(:vlan_translations) 6 | end 7 | 8 | down do 9 | create_table(:vlan_translations) do 10 | primary_key :id 11 | String :uuid, :unique => true, :null => false 12 | 13 | Integer :translation_id, :index => true 14 | Bignum :mac_address 15 | Integer :vlan_id 16 | Integer :network_id 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /vnet/db/migrations/0013_learning_flows.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | Sequel.migration do 4 | up do 5 | alter_table(:datapaths) do 6 | add_column :enable_ovs_learn_action, TrueClass, :null=>false, :default=>true 7 | add_unique_constraint [:dpid, :node_id, :is_deleted] 8 | end 9 | end 10 | 11 | down do 12 | alter_table(:datapaths) do 13 | drop_column :enable_ovs_learn_action 14 | drop_unique_constraint [:dpid, :node_id, :is_deleted] 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /vnet/db/migrations/0014_topology_layer.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | Sequel.migration do 4 | up do 5 | create_table(:topology_layers) do 6 | primary_key :id 7 | 8 | Integer :overlay_id, :index => true, :null => false 9 | Integer :underlay_id, :index => true, :null => false 10 | 11 | DateTime :created_at, :null=>false 12 | DateTime :updated_at, :null=>false 13 | DateTime :deleted_at, :index => true 14 | Integer :is_deleted, :null=>false, :default=>0 15 | 16 | index [:overlay_id, :is_deleted] 17 | index [:underlay_id, :is_deleted] 18 | 19 | unique [:overlay_id, :underlay_id, :is_deleted] 20 | end 21 | end 22 | 23 | down do 24 | drop_table(:topology_layers) 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /vnet/lib/ext/kernel.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Kernel 4 | def argument_type_check(argument,expected_class) 5 | raise ArgumentError, "Expected: '#{expected_class}'. Got: '#{argument.class}'" unless argument.is_a?(expected_class) 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /vnet/lib/sequel/plugins/paranoia_is_deleted.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Set is_deleted column to id on deletion to allow for unique 4 | # constraints. 5 | 6 | module Sequel 7 | module Plugins 8 | module ParanoiaIsDeleted 9 | 10 | def self.apply(model, opts = OPTS) 11 | model.plugin :paranoia 12 | end 13 | 14 | module InstanceMethods 15 | def before_destroy 16 | self.is_deleted = self.id 17 | super 18 | end 19 | end 20 | 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /vnet/lib/vnet/api_rpc.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | require 'vnet' 4 | 5 | module Vnet 6 | 7 | if use_api_proxy 8 | raise "Could not load 'vnet/api_rpc', api proxy already loaded." 9 | end 10 | 11 | use_api_proxy = :rpc 12 | 13 | module NodeApi 14 | autoload :RpcProxy, 'vnet/node_api/rpc_proxy' 15 | end 16 | 17 | Vnet::NodeApi.set_proxy_class(Vnet::NodeApi::RpcProxy) 18 | 19 | end 20 | -------------------------------------------------------------------------------- /vnet/lib/vnet/constants/active_port.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Constants::ActivePort 4 | MODE_INTERFACE = 'interface' 5 | MODE_LOCAL = 'local' 6 | MODE_TUNNEL = 'tunnel' 7 | MODE_UNKNOWN = 'unknown' 8 | 9 | MODES = [MODE_INTERFACE, 10 | MODE_LOCAL, 11 | MODE_TUNNEL, 12 | MODE_UNKNOWN, 13 | ] 14 | end 15 | -------------------------------------------------------------------------------- /vnet/lib/vnet/constants/filter.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Constants::Filter 4 | MODE_STATIC = 'static' 5 | 6 | MODES = [ MODE_STATIC ] 7 | end 8 | -------------------------------------------------------------------------------- /vnet/lib/vnet/constants/filter_static.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Constants::FilterStatic 4 | PROTOCOL_TCP = 'tcp' 5 | PROTOCOL_UDP = 'udp' 6 | PROTOCOL_ICMP = 'icmp' 7 | PROTOCOL_ARP = 'arp' 8 | PROTOCOL_IP = 'ip' 9 | 10 | PROTOCOLS = [ 11 | PROTOCOL_TCP, 12 | PROTOCOL_UDP, 13 | PROTOCOL_ICMP, 14 | PROTOCOL_ARP, 15 | PROTOCOL_IP 16 | ] 17 | end 18 | -------------------------------------------------------------------------------- /vnet/lib/vnet/constants/interface.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Constants::Interface 4 | MODE_HOST = 'host' 5 | MODE_INTERNAL = 'internal' 6 | MODE_PATCH = 'patch' 7 | MODE_PROMISCUOUS = 'promiscuous' 8 | MODE_REMOTE = 'remote' 9 | MODE_SIMULATED = 'simulated' 10 | MODE_VIF = 'vif' 11 | 12 | MODES = [MODE_HOST, 13 | MODE_INTERNAL, 14 | MODE_PATCH, 15 | MODE_PROMISCUOUS, 16 | MODE_REMOTE, 17 | MODE_SIMULATED, 18 | MODE_VIF, 19 | ] 20 | end 21 | -------------------------------------------------------------------------------- /vnet/lib/vnet/constants/lease_policy.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Constants 4 | module LeasePolicy 5 | ALLOCATION_TYPE_INCREMENTAL="incremental" 6 | ALLOCATION_TYPE_DECREMENTAL="decremental" 7 | ALLOCATION_TYPE_RANDOM="random" 8 | 9 | ALLOCATION_TYPES = [ 10 | ALLOCATION_TYPE_INCREMENTAL, 11 | ALLOCATION_TYPE_DECREMENTAL, 12 | ALLOCATION_TYPE_RANDOM 13 | ] 14 | 15 | 16 | MODE_SIMPLE = "simple" 17 | MODES = [ MODE_SIMPLE ] 18 | 19 | TIMING_IMMEDIATE = "immediate" 20 | TIMING_DHCP = "dhcp" 21 | TIMINGS = [ TIMING_IMMEDIATE, TIMING_DHCP ] 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /vnet/lib/vnet/constants/mac_address_prefix.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Constants::MacAddressPrefix 4 | MAC_ADDRESS_PREFIX_GW = "00:99:99" 5 | MAC_ADDRESS_PREFIX_DATAPATH_ROUTE_LINK = "00:99:98" 6 | MAC_ADDRESS_PREFIX_ROUTE_LINK = "00:99:97" 7 | MAC_ADDRESS_PREFIX_DATAPATH_NETWORK = "00:99:96" 8 | end 9 | -------------------------------------------------------------------------------- /vnet/lib/vnet/constants/network.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Constants::Network 4 | MODE_INTERNAL = 'internal' 5 | MODE_PHYSICAL = 'physical' 6 | MODE_VIRTUAL = 'virtual' 7 | 8 | MODES = [MODE_INTERNAL, 9 | MODE_PHYSICAL, 10 | MODE_VIRTUAL] 11 | end 12 | -------------------------------------------------------------------------------- /vnet/lib/vnet/constants/network_service.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Constants::NetworkService 4 | MODE_DHCP = 'dhcp' 5 | MODE_DNS = 'dns' 6 | MODE_ROUTER = 'router' 7 | 8 | MODES = [MODE_DHCP, 9 | MODE_DNS, 10 | MODE_ROUTER, 11 | ] 12 | end 13 | -------------------------------------------------------------------------------- /vnet/lib/vnet/constants/segment.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Constants::Segment 4 | MODE_PHYSICAL = 'physical' 5 | MODE_VIRTUAL = 'virtual' 6 | 7 | MODES = [MODE_PHYSICAL, 8 | MODE_VIRTUAL] 9 | end 10 | -------------------------------------------------------------------------------- /vnet/lib/vnet/constants/topology.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Constants::Topology 4 | MODE_SIMPLE_OVERLAY = 'simple_overlay' 5 | MODE_SIMPLE_UNDERLAY = 'simple_underlay' 6 | 7 | MODES = [MODE_SIMPLE_OVERLAY, 8 | MODE_SIMPLE_UNDERLAY] 9 | 10 | MODES_WITH_OVERLAYS = [MODE_SIMPLE_UNDERLAY] 11 | MODES_WITH_UNDERLAYS = [MODE_SIMPLE_OVERLAY] 12 | 13 | MODES_WITH_DATAPATHS = [MODE_SIMPLE_UNDERLAY] 14 | MODES_WITH_NETWORKS = [MODE_SIMPLE_OVERLAY, 15 | MODE_SIMPLE_UNDERLAY] 16 | MODES_WITH_SEGMENTS = [MODE_SIMPLE_OVERLAY, 17 | MODE_SIMPLE_UNDERLAY] 18 | MODES_WITH_ROUTE_LINKS = [MODE_SIMPLE_OVERLAY] 19 | MODES_WITH_MAC_RANGE_GROUPS = [MODE_SIMPLE_UNDERLAY] 20 | end 21 | -------------------------------------------------------------------------------- /vnet/lib/vnet/constants/translation.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Constants::Translation 4 | MODE_STATIC_ADDRESS = 'static_address' 5 | 6 | MODES = [MODE_STATIC_ADDRESS] 7 | end 8 | -------------------------------------------------------------------------------- /vnet/lib/vnet/constants/vnet_api.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Constants::VnetAPI 4 | CONF_LOCATION="/etc/openvnet/vnmgr.conf".freeze 5 | end 6 | -------------------------------------------------------------------------------- /vnet/lib/vnet/core/active_interfaces/local.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Core::ActiveInterfaces 4 | 5 | class Local < Base 6 | 7 | def mode 8 | :local 9 | end 10 | 11 | def log_type 12 | 'active_interface/local' 13 | end 14 | 15 | end 16 | 17 | end 18 | -------------------------------------------------------------------------------- /vnet/lib/vnet/core/active_networks/local.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Core::ActiveNetworks 4 | 5 | class Local < Base 6 | 7 | def mode 8 | :local 9 | end 10 | 11 | def log_type 12 | 'active_network/local' 13 | end 14 | 15 | end 16 | 17 | end 18 | -------------------------------------------------------------------------------- /vnet/lib/vnet/core/active_networks/remote.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Core::ActiveNetworks 4 | 5 | class Remote < Base 6 | 7 | def mode 8 | :remote 9 | end 10 | 11 | def log_type 12 | 'active_network/remote' 13 | end 14 | 15 | end 16 | 17 | end 18 | -------------------------------------------------------------------------------- /vnet/lib/vnet/core/active_ports/local.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Core::ActivePorts 4 | 5 | class Local < Base 6 | 7 | def mode 8 | :local 9 | end 10 | 11 | def log_type 12 | 'active_port/local' 13 | end 14 | 15 | end 16 | 17 | end 18 | -------------------------------------------------------------------------------- /vnet/lib/vnet/core/active_ports/tunnel.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Core::ActivePorts 4 | 5 | class Tunnel < Base 6 | 7 | def mode 8 | :tunnel 9 | end 10 | 11 | def log_type 12 | 'active_port/tunnel' 13 | end 14 | 15 | end 16 | 17 | end 18 | -------------------------------------------------------------------------------- /vnet/lib/vnet/core/active_ports/unknown.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Core::ActivePorts 4 | 5 | class Unknown < Base 6 | 7 | def mode 8 | :unknown 9 | end 10 | 11 | def log_type 12 | 'active_port/unknown' 13 | end 14 | 15 | end 16 | 17 | end 18 | -------------------------------------------------------------------------------- /vnet/lib/vnet/core/active_route_links/local.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Core::ActiveRouteLinks 4 | 5 | class Local < Base 6 | 7 | def mode 8 | :local 9 | end 10 | 11 | def log_type 12 | 'active_route_link/local' 13 | end 14 | 15 | end 16 | 17 | end 18 | -------------------------------------------------------------------------------- /vnet/lib/vnet/core/active_route_links/remote.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Core::ActiveRouteLinks 4 | 5 | class Remote < Base 6 | 7 | def mode 8 | :remote 9 | end 10 | 11 | def log_type 12 | 'active_route_link/remote' 13 | end 14 | 15 | end 16 | 17 | end 18 | -------------------------------------------------------------------------------- /vnet/lib/vnet/core/active_segments/local.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Core::ActiveSegments 4 | 5 | class Local < Base 6 | 7 | def mode 8 | :local 9 | end 10 | 11 | def log_type 12 | 'active_segment/local' 13 | end 14 | 15 | end 16 | 17 | end 18 | -------------------------------------------------------------------------------- /vnet/lib/vnet/core/active_segments/remote.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Core::ActiveSegments 4 | 5 | class Remote < Base 6 | 7 | def mode 8 | :remote 9 | end 10 | 11 | def log_type 12 | 'active_segment/remote' 13 | end 14 | 15 | end 16 | 17 | end 18 | -------------------------------------------------------------------------------- /vnet/lib/vnet/core/port.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | require 'ostruct' 4 | 5 | module Vnet::Core 6 | 7 | class Port < OpenStruct 8 | end 9 | 10 | end 11 | -------------------------------------------------------------------------------- /vnet/lib/vnet/core/ports/local.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Core::Ports 4 | 5 | module Local 6 | include Vnet::Openflow::FlowHelpers 7 | 8 | def log_type 9 | 'port/local' 10 | end 11 | 12 | def port_type 13 | :local 14 | end 15 | 16 | end 17 | 18 | end 19 | -------------------------------------------------------------------------------- /vnet/lib/vnet/core/service.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | require 'ostruct' 4 | 5 | module Vnet::Core 6 | 7 | class Service < OpenStruct 8 | 9 | end 10 | 11 | end 12 | -------------------------------------------------------------------------------- /vnet/lib/vnet/core/services/router.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | require 'racket' 4 | 5 | module Vnet::Core::Services 6 | 7 | class Router < Base 8 | 9 | def log_type 10 | 'service/router' 11 | end 12 | 13 | def install 14 | debug log_format('install', "interface_id:#{@interface_id}") 15 | end 16 | 17 | # 18 | # Internal methods: 19 | # 20 | 21 | private 22 | 23 | end 24 | 25 | end 26 | -------------------------------------------------------------------------------- /vnet/lib/vnet/core/tunnel.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | require 'ostruct' 4 | 5 | module Vnet::Core 6 | 7 | class Tunnel < OpenStruct 8 | 9 | end 10 | 11 | end 12 | -------------------------------------------------------------------------------- /vnet/lib/vnet/core/tunnels/unknown.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Core::Tunnels 4 | 5 | class Unknown < Base 6 | 7 | def mode 8 | :unknown 9 | end 10 | 11 | def log_type 12 | 'tunnels/unknown' 13 | end 14 | 15 | def create_tunnel 16 | return if @tunnel_created == true 17 | 18 | end 19 | 20 | # 21 | # Internal methods: 22 | # 23 | 24 | private 25 | 26 | end 27 | 28 | end 29 | -------------------------------------------------------------------------------- /vnet/lib/vnet/endpoints/1.0/ip_lease_containers.rb: -------------------------------------------------------------------------------- 1 | Vnet::Endpoints::V10::VnetAPI.namespace '/ip_lease_containers' do 2 | def self.put_post_shared_params 3 | end 4 | 5 | put_post_shared_params 6 | param_uuid M::IpLeaseContainer 7 | post do 8 | post_new(:IpLeaseContainer) 9 | end 10 | 11 | get do 12 | get_all(:IpLeaseContainer) 13 | end 14 | 15 | get '/:uuid' do 16 | get_by_uuid(:IpLeaseContainer) 17 | end 18 | 19 | delete '/:uuid' do 20 | delete_by_uuid(:IpLeaseContainer) 21 | end 22 | 23 | put_post_shared_params 24 | put '/:uuid' do 25 | update_by_uuid(:IpLeaseContainer) 26 | end 27 | 28 | get '/:uuid/ip_leases' do 29 | show_relations(:IpLeaseContainer, :ip_leases) 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /vnet/lib/vnet/endpoints/1.0/responses/datapath_network.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Endpoints::V10::Responses 4 | class DatapathNetwork < Vnet::Endpoints::CollectionResponseGenerator 5 | def self.generate(object) 6 | argument_type_check(object, Vnet::ModelWrappers::DatapathNetwork) 7 | object.to_hash 8 | end 9 | end 10 | 11 | class DatapathNetworkCollection < Vnet::Endpoints::CollectionResponseGenerator 12 | def self.generate(array) 13 | argument_type_check(array,Array) 14 | array.map { |i| 15 | DatapathNetwork.generate(i) 16 | } 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /vnet/lib/vnet/endpoints/1.0/responses/datapath_route_link.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Endpoints::V10::Responses 4 | class DatapathRouteLink < Vnet::Endpoints::CollectionResponseGenerator 5 | def self.generate(object) 6 | argument_type_check(object,Vnet::ModelWrappers::DatapathRouteLink) 7 | object.to_hash 8 | end 9 | end 10 | 11 | class DatapathRouteLinkCollection < Vnet::Endpoints::CollectionResponseGenerator 12 | def self.generate(array) 13 | argument_type_check(array,Array) 14 | array.map { |i| 15 | DatapathRouteLink.generate(i) 16 | } 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /vnet/lib/vnet/endpoints/1.0/responses/dns_record.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | require "ipaddress" 4 | 5 | module Vnet::Endpoints::V10::Responses 6 | class DnsRecord < Vnet::Endpoints::CollectionResponseGenerator 7 | def self.generate(model) 8 | argument_type_check(model, Vnet::ModelWrappers::DnsRecord) 9 | model.to_hash 10 | end 11 | end 12 | 13 | class DnsRecordCollection < Vnet::Endpoints::CollectionResponseGenerator 14 | def self.generate(array) 15 | argument_type_check(array, Array) 16 | array.map { |i| DnsRecord.generate(i) } 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /vnet/lib/vnet/endpoints/1.0/responses/dns_service.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Endpoints::V10::Responses 4 | class DnsService < Vnet::Endpoints::CollectionResponseGenerator 5 | def self.generate(model) 6 | argument_type_check(model, Vnet::ModelWrappers::DnsService) 7 | model.network_service_uuid = model.network_service.uuid 8 | model.to_hash 9 | end 10 | end 11 | 12 | class DnsServiceCollection < Vnet::Endpoints::CollectionResponseGenerator 13 | def self.generate(array) 14 | argument_type_check(array, Array) 15 | array.map { |i| DnsService.generate(i) } 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /vnet/lib/vnet/endpoints/1.0/responses/interface_port.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Endpoints::V10::Responses 4 | class InterfacePort < Vnet::Endpoints::CollectionResponseGenerator 5 | def self.generate(object) 6 | argument_type_check(object,Vnet::ModelWrappers::InterfacePort) 7 | object.to_hash 8 | end 9 | end 10 | 11 | class InterfacePortCollection < Vnet::Endpoints::CollectionResponseGenerator 12 | def self.generate(array) 13 | argument_type_check(array,Array) 14 | array.map { |i| 15 | InterfacePort.generate(i) 16 | } 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /vnet/lib/vnet/endpoints/1.0/responses/ip_address.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Endpoints::V10::Responses 4 | class IpAddress < Vnet::Endpoints::CollectionResponseGenerator 5 | def self.generate(object) 6 | argument_type_check(object,Vnet::ModelWrappers::IpAddress) 7 | object.to_hash 8 | end 9 | end 10 | 11 | class IpAddressCollection < Vnet::Endpoints::CollectionResponseGenerator 12 | def self.generate(array) 13 | argument_type_check(array,Array) 14 | array.map { |i| 15 | IpAddress.generate(i) 16 | } 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /vnet/lib/vnet/endpoints/1.0/responses/ip_lease_container.rb: -------------------------------------------------------------------------------- 1 | module Vnet::Endpoints::V10::Responses 2 | class IpLeaseContainer < Vnet::Endpoints::CollectionResponseGenerator 3 | def self.generate(object) 4 | argument_type_check(object,Vnet::ModelWrappers::IpLeaseContainer) 5 | object.to_hash 6 | end 7 | end 8 | 9 | class IpLeaseContainerCollection < Vnet::Endpoints::CollectionResponseGenerator 10 | def self.generate(array) 11 | argument_type_check(array,Array) 12 | array.map { |i| IpLeaseContainer.generate(i) } 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /vnet/lib/vnet/endpoints/1.0/responses/ip_range.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Endpoints::V10::Responses 4 | class IpRange < Vnet::Endpoints::CollectionResponseGenerator 5 | def self.generate(object) 6 | argument_type_check(object, Vnet::ModelWrappers::IpRange) 7 | object.to_hash 8 | end 9 | end 10 | 11 | class IpRangeCollection < Vnet::Endpoints::CollectionResponseGenerator 12 | def self.generate(array) 13 | argument_type_check(array, Array) 14 | array.map { |i| IpRange.generate(i) } 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /vnet/lib/vnet/endpoints/1.0/responses/ip_range_group.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Endpoints::V10::Responses 4 | class IpRangeGroup < Vnet::Endpoints::CollectionResponseGenerator 5 | def self.generate(object) 6 | argument_type_check(object,Vnet::ModelWrappers::IpRangeGroup) 7 | object.to_hash 8 | end 9 | end 10 | 11 | class IpRangeGroupCollection < Vnet::Endpoints::CollectionResponseGenerator 12 | def self.generate(array) 13 | argument_type_check(array,Array) 14 | array.map { |i| 15 | IpRangeGroup.generate(i) 16 | } 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /vnet/lib/vnet/endpoints/1.0/responses/ip_retention.rb: -------------------------------------------------------------------------------- 1 | module Vnet::Endpoints::V10::Responses 2 | class IpRetention < Vnet::Endpoints::CollectionResponseGenerator 3 | def self.generate(object) 4 | argument_type_check(object,Vnet::ModelWrappers::IpRetention) 5 | object.to_hash 6 | end 7 | end 8 | 9 | class IpRetentionCollection < Vnet::Endpoints::CollectionResponseGenerator 10 | def self.generate(array) 11 | argument_type_check(array,Array) 12 | array.map { |i| IpRetention.generate(i) } 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /vnet/lib/vnet/endpoints/1.0/responses/ip_retention_container.rb: -------------------------------------------------------------------------------- 1 | module Vnet::Endpoints::V10::Responses 2 | class IpRetentionContainer < Vnet::Endpoints::CollectionResponseGenerator 3 | def self.generate(object) 4 | argument_type_check(object,Vnet::ModelWrappers::IpRetentionContainer) 5 | object.to_hash 6 | end 7 | end 8 | 9 | class IpRetentionContainerCollection < Vnet::Endpoints::CollectionResponseGenerator 10 | def self.generate(array) 11 | argument_type_check(array,Array) 12 | array.map { |i| IpRetentionContainer.generate(i) } 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /vnet/lib/vnet/endpoints/1.0/responses/mac_address.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Endpoints::V10::Responses 4 | class MacAddress < Vnet::Endpoints::CollectionResponseGenerator 5 | def self.generate(object) 6 | argument_type_check(object,Vnet::ModelWrappers::MacAddress) 7 | object.to_hash 8 | end 9 | end 10 | 11 | class MacAddressCollection < Vnet::Endpoints::CollectionResponseGenerator 12 | def self.generate(array) 13 | argument_type_check(array,Array) 14 | array.map { |i| 15 | MacAddress.generate(i) 16 | } 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /vnet/lib/vnet/endpoints/1.0/responses/mac_lease.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Endpoints::V10::Responses 4 | class MacLease < Vnet::Endpoints::CollectionResponseGenerator 5 | def self.generate(object) 6 | argument_type_check(object,Vnet::ModelWrappers::MacLease) 7 | object.interface_uuid ||= object.interface.uuid 8 | object.mac_address = object.mac_address_s 9 | object.to_hash 10 | end 11 | end 12 | 13 | class MacLeaseCollection < Vnet::Endpoints::CollectionResponseGenerator 14 | def self.generate(array) 15 | argument_type_check(array,Array) 16 | array.map { |i| 17 | MacLease.generate(i) 18 | } 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /vnet/lib/vnet/endpoints/1.0/responses/mac_range.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Endpoints::V10::Responses 4 | class MacRange < Vnet::Endpoints::CollectionResponseGenerator 5 | def self.generate(object) 6 | argument_type_check(object, Vnet::ModelWrappers::MacRange) 7 | object.to_hash 8 | end 9 | end 10 | 11 | class MacRangeCollection < Vnet::Endpoints::CollectionResponseGenerator 12 | def self.generate(array) 13 | argument_type_check(array, Array) 14 | array.map { |i| MacRange.generate(i) } 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /vnet/lib/vnet/endpoints/1.0/responses/mac_range_group.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Endpoints::V10::Responses 4 | class MacRangeGroup < Vnet::Endpoints::CollectionResponseGenerator 5 | def self.generate(object) 6 | argument_type_check(object,Vnet::ModelWrappers::MacRangeGroup) 7 | object.to_hash 8 | end 9 | end 10 | 11 | class MacRangeGroupCollection < Vnet::Endpoints::CollectionResponseGenerator 12 | def self.generate(array) 13 | argument_type_check(array,Array) 14 | array.map { |i| 15 | MacRangeGroup.generate(i) 16 | } 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /vnet/lib/vnet/endpoints/1.0/responses/network.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | require "ipaddress" 4 | 5 | module Vnet::Endpoints::V10::Responses 6 | class Network < Vnet::Endpoints::CollectionResponseGenerator 7 | def self.generate(network) 8 | argument_type_check(network, Vnet::ModelWrappers::Network) 9 | res = network.to_hash 10 | 11 | res[:ipv4_network] = network.ipv4_network_s 12 | res 13 | end 14 | end 15 | 16 | class NetworkCollection < Vnet::Endpoints::CollectionResponseGenerator 17 | def self.generate(array) 18 | argument_type_check(array, Array) 19 | array.map { |i| Network.generate(i) } 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /vnet/lib/vnet/endpoints/1.0/responses/network_service.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Endpoints::V10::Responses 4 | class NetworkService < Vnet::Endpoints::CollectionResponseGenerator 5 | def self.generate(object) 6 | argument_type_check(object,Vnet::ModelWrappers::NetworkService) 7 | object[:interface_uuid] = object.interface.uuid if object.interface 8 | object.to_hash 9 | end 10 | end 11 | 12 | class NetworkServiceCollection < Vnet::Endpoints::CollectionResponseGenerator 13 | def self.generate(array) 14 | argument_type_check(array,Array) 15 | array.map { |i| 16 | NetworkService.generate(i) 17 | } 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /vnet/lib/vnet/endpoints/1.0/responses/route.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Endpoints::V10::Responses 4 | class Route < Vnet::Endpoints::CollectionResponseGenerator 5 | def self.generate(route) 6 | argument_type_check(route, Vnet::ModelWrappers::Route) 7 | res = route.to_hash 8 | res[:ipv4_network] = route.ipv4_network_s 9 | res 10 | end 11 | end 12 | 13 | class RouteCollection < Vnet::Endpoints::CollectionResponseGenerator 14 | def self.generate(array) 15 | argument_type_check(array,Array) 16 | array.map { |i| Route.generate(i) } 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /vnet/lib/vnet/endpoints/1.0/responses/route_link.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Endpoints::V10::Responses 4 | class RouteLink < Vnet::Endpoints::CollectionResponseGenerator 5 | def self.generate(object) 6 | argument_type_check(object,Vnet::ModelWrappers::RouteLink) 7 | object.to_hash.merge({ mac_address: object.mac_address_s }) 8 | end 9 | end 10 | 11 | class RouteLinkCollection < Vnet::Endpoints::CollectionResponseGenerator 12 | def self.generate(array) 13 | argument_type_check(array,Array) 14 | array.map { |i| 15 | RouteLink.generate(i) 16 | } 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /vnet/lib/vnet/endpoints/1.0/responses/segment.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Endpoints::V10::Responses 4 | class Segment < Vnet::Endpoints::CollectionResponseGenerator 5 | def self.generate(object) 6 | argument_type_check(object, Vnet::ModelWrappers::Segment) 7 | object.to_hash 8 | end 9 | end 10 | 11 | class SegmentCollection < Vnet::Endpoints::CollectionResponseGenerator 12 | def self.generate(array) 13 | argument_type_check(array, Array) 14 | array.map { |i| Segment.generate(i) } 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /vnet/lib/vnet/endpoints/1.0/route_links.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | Vnet::Endpoints::V10::VnetAPI.namespace '/route_links' do 4 | 5 | param_uuid M::RouteLink 6 | param_uuid M::Topology, :topology_uuid 7 | param :mac_address, :String, transform: PARSE_MAC 8 | post do 9 | uuid_to_id(M::Topology, 'topology_uuid', 'topology_id') if params['topology_uuid'] 10 | 11 | post_new(:RouteLink) 12 | end 13 | 14 | get do 15 | get_all(:RouteLink) 16 | end 17 | 18 | get '/:uuid' do 19 | get_by_uuid(:RouteLink) 20 | end 21 | 22 | delete '/:uuid' do 23 | delete_by_uuid(:RouteLink) 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /vnet/lib/vnet/endpoints/1.0/segments.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | Vnet::Endpoints::V10::VnetAPI.namespace '/segments' do 4 | 5 | param_uuid M::Segment 6 | param_uuid M::Topology, :topology_uuid 7 | param :mode, :String, in: C::Segment::MODES, required: true 8 | post do 9 | uuid_to_id(M::Topology, 'topology_uuid', 'topology_id') if params['topology_uuid'] 10 | 11 | post_new(:Segment) 12 | end 13 | 14 | get do 15 | get_all(:Segment) 16 | end 17 | 18 | get '/:uuid' do 19 | get_by_uuid(:Segment) 20 | end 21 | 22 | delete '/:uuid' do 23 | delete_by_uuid(:Segment) 24 | end 25 | 26 | end 27 | -------------------------------------------------------------------------------- /vnet/lib/vnet/endpoints/response_generator.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Endpoints 4 | class ResponseGenerator 5 | def self.generate(record) 6 | raise NotImplementedError 7 | end 8 | end 9 | 10 | class CollectionResponseGenerator < ResponseGenerator 11 | def self.generate_with_pagination(pagination, items) 12 | pagination.tap do |pag| 13 | pag[:items] = generate(items) 14 | end 15 | end 16 | 17 | def self.generate(items) 18 | raise NotImplementedError 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /vnet/lib/vnet/event/dispatchable.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Event 4 | module Dispatchable 5 | mattr_accessor :event_handler 6 | 7 | def dispatch_event(event, options = {}) 8 | self.event_handler ||= _find_event_handler 9 | self.event_handler.async.handle_event(event, options) 10 | end 11 | 12 | def _find_event_handler 13 | DCell::Global[:event_handler] or raise "event_handler not found in DCell::Global" 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /vnet/lib/vnet/helpers/ip_address.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Helpers 4 | class IpAddress 5 | 6 | def self.valid_in_subnet(network, ipv4_address) 7 | return true if ipv4_address == 0 8 | ipv4_nw = IPAddress::IPv4.parse_u32(network.ipv4_network, network.ipv4_prefix) 9 | ipv4 = IPAddress::IPv4.parse_u32(ipv4_address, network.ipv4_prefix) 10 | 11 | [ipv4_nw.include?(ipv4), ipv4_nw, ipv4] 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /vnet/lib/vnet/initializers/logger.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Initializers 4 | class Logger 5 | def self.run(filename) 6 | log_dir = Vnet::LOG_DIRECTORY 7 | 8 | FileUtils.mkdir_p(log_dir) unless Dir.exists?(log_dir) 9 | Celluloid.logger = ::Logger.new(File.join(log_dir, filename)) 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /vnet/lib/vnet/model_wrappers/active_port.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::ModelWrappers 4 | 5 | class ActivePort < Base 6 | end 7 | 8 | end 9 | -------------------------------------------------------------------------------- /vnet/lib/vnet/model_wrappers/datapath.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | require 'ipaddress' 3 | 4 | module Vnet::ModelWrappers 5 | 6 | class Datapath < Base 7 | include Helpers::IPv4 8 | 9 | def dpid_s 10 | "0x%016x" % dpid 11 | end 12 | end 13 | 14 | class DatapathNetwork < Base 15 | end 16 | 17 | class DatapathSegment < Base 18 | end 19 | 20 | class DatapathRouteLink < Base 21 | end 22 | 23 | end 24 | -------------------------------------------------------------------------------- /vnet/lib/vnet/model_wrappers/dns_record.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::ModelWrappers 4 | class DnsRecord < Base 5 | include Helpers::IPv4 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /vnet/lib/vnet/model_wrappers/dns_service.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::ModelWrappers 4 | class DnsService < Base 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /vnet/lib/vnet/model_wrappers/filter.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | require 'ipaddress' 3 | 4 | module Vnet::ModelWrappers 5 | 6 | class Filter < Base 7 | end 8 | 9 | class FilterStatic < Base 10 | #include Helpers::IPv4 11 | end 12 | 13 | end 14 | -------------------------------------------------------------------------------- /vnet/lib/vnet/model_wrappers/helpers.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::ModelWrappers::Helpers 4 | module IPv4 5 | def ipv4_address_s 6 | self.ipv4_address && parse_ipv4(self.ipv4_address) 7 | end 8 | 9 | def ipv4_network_s 10 | self.ipv4_network && parse_ipv4(self.ipv4_network) 11 | end 12 | 13 | private 14 | def parse_ipv4(ipv4) 15 | IPAddress::IPv4::parse_u32(ipv4).to_s 16 | end 17 | end 18 | 19 | module MacAddr 20 | def mac_address_s(delim = ":") 21 | self.mac_address && ( 22 | mac = self.mac_address.to_s(16) 23 | while mac.length < 12 24 | mac.insert(0,'0') 25 | end 26 | mac.scan(/.{2}|.+/).join(delim) 27 | ) 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /vnet/lib/vnet/model_wrappers/interface.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::ModelWrappers 4 | class Interface < Base 5 | end 6 | 7 | class InterfacePort < Base 8 | end 9 | 10 | class InterfaceNetwork < Base 11 | end 12 | 13 | class InterfaceSegment < Base 14 | end 15 | 16 | class InterfaceRouteLink < Base 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /vnet/lib/vnet/model_wrappers/ip_address.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::ModelWrappers 4 | class IpAddress < Base 5 | include Helpers::IPv4 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /vnet/lib/vnet/model_wrappers/ip_lease.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::ModelWrappers 4 | class IpLease < Base 5 | include Helpers::IPv4 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /vnet/lib/vnet/model_wrappers/ip_lease_container.rb: -------------------------------------------------------------------------------- 1 | module Vnet::ModelWrappers 2 | class IpLeaseContainer < Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /vnet/lib/vnet/model_wrappers/ip_lease_container_ip_lease.rb: -------------------------------------------------------------------------------- 1 | module Vnet::ModelWrappers 2 | class IpLeaseContainerIpLease < Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /vnet/lib/vnet/model_wrappers/ip_retention.rb: -------------------------------------------------------------------------------- 1 | module Vnet::ModelWrappers 2 | class IpRetention < Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /vnet/lib/vnet/model_wrappers/ip_retention_container.rb: -------------------------------------------------------------------------------- 1 | module Vnet::ModelWrappers 2 | class IpRetentionContainer < Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /vnet/lib/vnet/model_wrappers/lease_policy.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::ModelWrappers 4 | class LeasePolicy < Base 5 | 6 | end 7 | 8 | class LeasePolicyBaseNetwork < Base 9 | 10 | end 11 | 12 | class LeasePolicyBaseInterface < Base 13 | 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /vnet/lib/vnet/model_wrappers/lease_policy_ip_lease_container.rb: -------------------------------------------------------------------------------- 1 | module Vnet::ModelWrappers 2 | class LeasePolicyIpLeaseContainer < Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /vnet/lib/vnet/model_wrappers/lease_policy_ip_retention_container.rb: -------------------------------------------------------------------------------- 1 | module Vnet::ModelWrappers 2 | class LeasePolicyIpRetentionContainer < Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /vnet/lib/vnet/model_wrappers/mac_address.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::ModelWrappers 4 | class MacAddress < Base 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /vnet/lib/vnet/model_wrappers/mac_lease.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::ModelWrappers 4 | class MacLease < Base 5 | include Helpers::MacAddr 6 | 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /vnet/lib/vnet/model_wrappers/network.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | require 'ipaddress' 3 | 4 | module Vnet::ModelWrappers 5 | class Network < Base 6 | def ipv4_network_s 7 | IPAddress::IPv4::parse_u32(self.ipv4_network).to_s 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /vnet/lib/vnet/model_wrappers/network_service.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::ModelWrappers 4 | class NetworkService < Base 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /vnet/lib/vnet/model_wrappers/route_link.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::ModelWrappers 4 | class RouteLink < Base 5 | include Helpers::MacAddr 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /vnet/lib/vnet/model_wrappers/topology.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::ModelWrappers 4 | 5 | class Topology < Base 6 | end 7 | 8 | class TopologyDatapath < Base 9 | end 10 | 11 | class TopologyLayer < Base 12 | end 13 | 14 | class TopologyNetwork < Base 15 | end 16 | 17 | class TopologySegment < Base 18 | end 19 | 20 | class TopologyRouteLink < Base 21 | end 22 | 23 | class TopologyMacRangeGroup < Base 24 | end 25 | 26 | end 27 | -------------------------------------------------------------------------------- /vnet/lib/vnet/model_wrappers/translation.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | require 'ipaddress' 3 | 4 | module Vnet::ModelWrappers 5 | 6 | class Translation < Base 7 | end 8 | 9 | class TranslationStaticAddress < Base 10 | #include Helpers::IPv4 11 | end 12 | 13 | end 14 | -------------------------------------------------------------------------------- /vnet/lib/vnet/model_wrappers/tunnel.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::ModelWrappers 4 | class Tunnel < Base 5 | def to_hash 6 | { 7 | :uuid => self.uuid, 8 | :src_datapath_id => self.src_datapath_id, 9 | :dst_datapath_id => self.dst_datapath_id, 10 | :display_name => self.display_name, 11 | :created_at => self.created_at, 12 | :updated_at => self.updated_at 13 | } 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /vnet/lib/vnet/model_wrappers/wrappers.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::ModelWrappers 4 | 5 | class ActiveInterface < Base 6 | end 7 | 8 | class ActiveNetwork < Base 9 | end 10 | 11 | class ActiveRouteLink < Base 12 | end 13 | 14 | class ActiveSegment < Base 15 | end 16 | 17 | class IpRange < Base 18 | end 19 | 20 | class IpRangeGroup < Base 21 | end 22 | 23 | class MacRange < Base 24 | end 25 | 26 | class MacRangeGroup < Base 27 | end 28 | 29 | class Segment < Base 30 | end 31 | 32 | end 33 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/active_interface.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Models 4 | 5 | class ActiveInterface < Base 6 | 7 | plugin :paranoia_is_deleted 8 | 9 | many_to_one :interface 10 | many_to_one :datapath 11 | 12 | # TODO: Cleanup. 13 | 14 | def validate 15 | super 16 | errors.add(:label, 'must be set if singular is null') if label.nil? && singular.nil? 17 | errors.add(:label, 'must be set to null if singular is true') if singular == true && label 18 | errors.add(:singular, 'must be set to either true or null') if singular != true && !singular.nil? 19 | end 20 | 21 | end 22 | 23 | end 24 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/active_network.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Models 4 | 5 | class ActiveNetwork < Base 6 | 7 | plugin :paranoia_is_deleted 8 | 9 | many_to_one :network 10 | many_to_one :datapath 11 | 12 | end 13 | 14 | end 15 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/active_port.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Models 4 | 5 | class ActivePort < Base 6 | plugin :paranoia_is_deleted 7 | 8 | use_modes Vnet::Constants::ActivePort::MODES 9 | 10 | many_to_one :datapath 11 | 12 | def validate 13 | super 14 | 15 | if !(port_number > 0 && port_number < (1 << 32)) 16 | errors.add(:port_number, 'invalid port_number value') 17 | end 18 | end 19 | 20 | end 21 | 22 | end 23 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/active_route_link.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Models 4 | 5 | class ActiveRouteLink < Base 6 | 7 | plugin :paranoia_is_deleted 8 | 9 | many_to_one :route_link 10 | many_to_one :datapath 11 | 12 | end 13 | 14 | end 15 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/active_segment.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Models 4 | 5 | class ActiveSegment < Base 6 | 7 | plugin :paranoia_is_deleted 8 | 9 | many_to_one :segment 10 | many_to_one :datapath 11 | 12 | end 13 | 14 | end 15 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/dns_record.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Models 4 | class DnsRecord < Base 5 | taggable "dnsr" 6 | 7 | plugin :paranoia_is_deleted 8 | 9 | many_to_one :dns_service 10 | 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/filter.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Models 4 | class Filter < Base 5 | taggable 'fil' 6 | plugin :paranoia_is_deleted 7 | 8 | # TODO: Disabling 'use_modes' until specs are fixed. 9 | # use_modes Vnet::Constants::Filter::MODES 10 | 11 | one_to_many :filter_statics 12 | 13 | many_to_one :interface 14 | 15 | plugin :association_dependencies, 16 | # 0006_filters 17 | filter_statics: :destroy 18 | 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/interface_network.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Models 4 | class InterfaceNetwork < Base 5 | plugin :paranoia_is_deleted 6 | 7 | many_to_one :interface 8 | many_to_one :network 9 | 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/interface_port.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Models 4 | class InterfacePort < Base 5 | plugin :paranoia_is_deleted 6 | 7 | many_to_one :interface 8 | many_to_one :datapath 9 | 10 | dataset_module do 11 | def join_interface_segments 12 | self.join(:interface_segments, interface_segments__interface_id: :interface_ports__interface_id) 13 | end 14 | end 15 | 16 | def validate 17 | super 18 | 19 | if singular != true && !singular.nil? 20 | errors.add(:singular, 'must be set to either true or null') 21 | end 22 | end 23 | 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/interface_route_link.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Models 4 | class InterfaceRouteLink < Base 5 | plugin :paranoia_is_deleted 6 | 7 | many_to_one :interface 8 | many_to_one :route_link 9 | 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/interface_segment.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Models 4 | class InterfaceSegment < Base 5 | plugin :paranoia_is_deleted 6 | 7 | many_to_one :interface 8 | many_to_one :segment 9 | 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/ip_lease_container_ip_lease.rb: -------------------------------------------------------------------------------- 1 | module Vnet::Models 2 | 3 | # TODO: Refactor. 4 | class IpLeaseContainerIpLease < Base 5 | many_to_one :ip_lease_container 6 | many_to_one :ip_lease 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/ip_range_group.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Models 4 | 5 | # TODO: Refactor. 6 | class IpRangeGroup < Base 7 | taggable 'iprg' 8 | 9 | plugin :paranoia_is_deleted 10 | 11 | one_to_many :lease_policy_base_networks 12 | one_to_many :ip_ranges 13 | end 14 | 15 | end 16 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/ip_retention.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Models 4 | class IpRetention < Base 5 | plugin :paranoia_is_deleted 6 | 7 | many_to_one :ip_lease 8 | many_to_one :ip_retention_container 9 | 10 | # TODO: Should we delete the ip lease? 11 | # TODO: Should we use created_at column for leased_at? 12 | 13 | def expire 14 | if ip_retention_container.grace_time 15 | self.released_at = Time.now 16 | save_changes 17 | else 18 | destroy 19 | end 20 | end 21 | 22 | def before_create 23 | self.leased_at = Time.now 24 | super 25 | end 26 | 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/lease_policy_base_interface.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Models 4 | 5 | # TODO: Refactor. 6 | 7 | class LeasePolicyBaseInterface < Base 8 | 9 | many_to_one :lease_policy 10 | many_to_one :interface 11 | 12 | end 13 | 14 | end 15 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/lease_policy_base_network.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Models 4 | 5 | # TODO: Refactor. 6 | 7 | class LeasePolicyBaseNetwork < Base 8 | 9 | many_to_one :lease_policy 10 | many_to_one :network 11 | many_to_one :ip_range_group 12 | 13 | end 14 | 15 | end 16 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/lease_policy_ip_lease_container.rb: -------------------------------------------------------------------------------- 1 | module Vnet::Models 2 | 3 | # TODO: Refactor. 4 | class LeasePolicyIpLeaseContainer < Base 5 | many_to_one :lease_policy 6 | many_to_one :ip_lease_container 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/lease_policy_ip_retention_container.rb: -------------------------------------------------------------------------------- 1 | module Vnet::Models 2 | 3 | # TODO: Refactor. 4 | class LeasePolicyIpRetentionContainer < Base 5 | many_to_one :lease_policy 6 | many_to_one :ip_retention_container 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/mac_address.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Models 4 | class MacAddress < Base 5 | taggable 'mac' 6 | 7 | plugin :paranoia_is_deleted 8 | 9 | many_to_one :segment 10 | one_to_one :mac_lease 11 | 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/mac_lease.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Models 4 | class MacLease < Base 5 | taggable 'ml' 6 | 7 | plugin :paranoia_is_deleted 8 | plugin :mac_address 9 | 10 | many_to_one :interface 11 | one_to_many :ip_leases 12 | 13 | plugin :association_dependencies, 14 | # 0001_origin 15 | ip_leases: :destroy, 16 | _mac_address: :destroy 17 | 18 | def cookie_id 19 | self.class.with_deleted.where(interface_id: self.interface_id).where("id <= ?", self.id).count 20 | end 21 | 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/network_service.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Models 4 | class NetworkService < Base 5 | taggable 'ns' 6 | plugin :paranoia_is_deleted 7 | 8 | use_modes Vnet::Constants::NetworkService::MODES 9 | 10 | many_to_one :interface 11 | one_to_many :dns_services 12 | 13 | plugin :association_dependencies, 14 | # 0002_services 15 | dns_services: :destroy 16 | 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/topology_datapath.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Models 4 | 5 | class TopologyDatapath < Base 6 | plugin :paranoia_is_deleted 7 | 8 | many_to_one :topology 9 | many_to_one :datapath 10 | 11 | def validate 12 | if Vnet::Constants::Topology::MODES_WITH_DATAPATHS.include?(topology.mode).nil? 13 | errors.add(:topology__mode, 'must be a valid mode') 14 | end 15 | 16 | super 17 | end 18 | 19 | end 20 | 21 | end 22 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/topology_network.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Models 4 | 5 | class TopologyNetwork < Base 6 | plugin :paranoia_is_deleted 7 | 8 | many_to_one :network 9 | many_to_one :topology 10 | 11 | def validate 12 | if Vnet::Constants::Topology::MODES_WITH_NETWORKS.include?(topology.mode).nil? 13 | errors.add(:topology__mode, 'must be a valid mode') 14 | end 15 | 16 | super 17 | end 18 | 19 | end 20 | 21 | end 22 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/topology_route_link.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Models 4 | 5 | class TopologyRouteLink < Base 6 | plugin :paranoia_is_deleted 7 | 8 | many_to_one :route_link 9 | many_to_one :topology 10 | 11 | def validate 12 | if Vnet::Constants::Topology::MODES_WITH_ROUTE_LINKS.include?(topology.mode).nil? 13 | errors.add(:topology__mode, 'must be a valid mode') 14 | end 15 | 16 | super 17 | end 18 | 19 | end 20 | 21 | end 22 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/topology_segment.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Models 4 | 5 | class TopologySegment < Base 6 | plugin :paranoia_is_deleted 7 | 8 | many_to_one :segment 9 | many_to_one :topology 10 | 11 | def validate 12 | if Vnet::Constants::Topology::MODES_WITH_SEGMENTS.include?(topology.mode).nil? 13 | errors.add(:topology__mode, 'must be a valid mode') 14 | end 15 | 16 | super 17 | end 18 | 19 | end 20 | 21 | end 22 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/translation.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Models 4 | class Translation < Base 5 | taggable 'tr' 6 | plugin :paranoia_is_deleted 7 | 8 | use_modes Vnet::Constants::Translation::MODES 9 | 10 | one_to_many :translation_static_addresses 11 | 12 | many_to_one :interface 13 | 14 | plugin :association_dependencies, 15 | # 0001_origin 16 | translation_static_addresses: :destroy 17 | 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /vnet/lib/vnet/models/translation_static_address.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Models 4 | 5 | class TranslationStaticAddress < Base 6 | plugin :paranoia_is_deleted 7 | 8 | many_to_one :translation 9 | many_to_one :route_link 10 | 11 | def ingress_ipv4_address_s 12 | self.ingress_ipv4_address && parse_ipv4(self.ingress_ipv4_address) 13 | end 14 | 15 | def egress_ipv4_address_s 16 | self.egress_ipv4_address && parse_ipv4(self.egress_ipv4_address) 17 | end 18 | 19 | #TODO: properly use module for this 20 | private 21 | 22 | def parse_ipv4(ipv4) 23 | IPAddress::IPv4::parse_u32(ipv4).to_s 24 | end 25 | 26 | end 27 | 28 | end 29 | -------------------------------------------------------------------------------- /vnet/lib/vnet/node_api/direct_proxy.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet 4 | module NodeApi 5 | class DirectProxy < Proxy 6 | protected 7 | class DirectCall < Call 8 | def initialize(class_name) 9 | super 10 | @method_caller = Vnet::NodeApi.const_get(class_name.to_s.camelize) 11 | end 12 | 13 | def _call(method_name, *args, &block) 14 | @method_caller.send(method_name, *args, &block) 15 | end 16 | end 17 | 18 | def _call_class 19 | DirectCall 20 | end 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /vnet/lib/vnet/node_api/dns_record.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::NodeApi 4 | 5 | class DnsRecord < LegacyBase 6 | class << self 7 | def create(options) 8 | super.tap do |model| 9 | dispatch_event( 10 | ADDED_DNS_RECORD, 11 | id: model.dns_service.network_service_id, 12 | dns_record_id: model.id 13 | ) 14 | end 15 | end 16 | 17 | def destroy(uuid) 18 | super.tap do |model| 19 | dispatch_event( 20 | REMOVED_DNS_RECORD, 21 | id: model.dns_service.network_service_id, 22 | dns_record_id: model.id 23 | ) 24 | end 25 | end 26 | end 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /vnet/lib/vnet/node_api/filter_static.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::NodeApi 4 | class FilterStatic < EventBase 5 | class << self 6 | private 7 | 8 | def dispatch_created_item_events(model) 9 | model_hash = model.to_hash.merge(id: model.filter_id, 10 | static_id: model.id) 11 | 12 | dispatch_event(FILTER_ADDED_STATIC, model_hash) 13 | end 14 | 15 | def dispatch_deleted_item_events(model) 16 | dispatch_event(FILTER_REMOVED_STATIC, 17 | id: model.filter_id, 18 | static_id: model.id) 19 | end 20 | 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /vnet/lib/vnet/node_api/ip_lease_container.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::NodeApi 4 | class IpLeaseContainer < EventBase 5 | valid_update_fields [] 6 | 7 | class << self 8 | private 9 | 10 | def dispatch_created_item_events(model) 11 | # dispatch_event(, model.to_hash) 12 | 13 | # 0001_origin 14 | # ip_lease_container_ip_leases: send? 15 | # 0002_services 16 | # lease_policy_ip_lease_containers: send? 17 | end 18 | 19 | def dispatch_deleted_item_events(model) 20 | # dispatch_event(, id: model.id) 21 | end 22 | 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /vnet/lib/vnet/node_api/models.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::NodeApi 4 | 5 | class LegacyBase < EventBase 6 | class << self 7 | private 8 | 9 | def dispatch_created_item_events(model) 10 | end 11 | 12 | def dispatch_deleted_item_events(model) 13 | end 14 | end 15 | end 16 | 17 | class IpAddress < LegacyBase 18 | valid_update_fields [] 19 | end 20 | 21 | class IpRange < LegacyBase 22 | valid_update_fields [] 23 | end 24 | 25 | class IpRangeGroup < LegacyBase 26 | valid_update_fields [:allocation_type] 27 | end 28 | 29 | class MacAddress < LegacyBase 30 | valid_update_fields [] 31 | end 32 | 33 | end 34 | -------------------------------------------------------------------------------- /vnet/lib/vnet/node_api/network_service.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::NodeApi 4 | class NetworkService < EventBase 5 | valid_update_fields [:display_name] 6 | 7 | class << self 8 | private 9 | 10 | def dispatch_created_item_events(model) 11 | dispatch_event(SERVICE_CREATED_ITEM, model.to_hash) 12 | end 13 | 14 | def dispatch_updated_item_events(model, old_values) 15 | end 16 | 17 | def dispatch_deleted_item_events(model) 18 | dispatch_event(SERVICE_DELETED_ITEM, model.to_hash) 19 | 20 | filter = { network_id: model.id } 21 | 22 | # 0002_services 23 | # dns_services: :destroy 24 | end 25 | 26 | end 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /vnet/lib/vnet/node_api/rpc_proxy.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet 4 | module NodeApi 5 | class RpcProxy < Proxy 6 | protected 7 | class RpcCall < Call 8 | def initialize(class_name) 9 | super 10 | @actor = DCell::Global[:rpc] or raise "rpc not found in DCell::Global" 11 | end 12 | 13 | def _call(method_name, *args, &block) 14 | @actor.execute(@class_name, method_name, *args, &block) 15 | end 16 | end 17 | 18 | def _call_class 19 | RpcCall 20 | end 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /vnet/lib/vnet/node_api/translation.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::NodeApi 4 | 5 | class Translation < EventBase 6 | valid_update_fields [] 7 | 8 | class << self 9 | private 10 | 11 | def dispatch_created_item_events(model) 12 | dispatch_event(TRANSLATION_CREATED_ITEM, model.to_hash) 13 | end 14 | 15 | def dispatch_deleted_item_events(model) 16 | dispatch_event(TRANSLATION_DELETED_ITEM, id: model.id) 17 | 18 | # 0001_origin 19 | # translation_static_addresses: ignore, handled by main event 20 | end 21 | 22 | end 23 | end 24 | 25 | end 26 | -------------------------------------------------------------------------------- /vnet/lib/vnet/node_api/translation_static_address.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::NodeApi 4 | class TranslationStaticAddress < EventBase 5 | class << self 6 | private 7 | 8 | def dispatch_created_item_events(model) 9 | model_hash = model.to_hash.merge(id: model.translation_id, 10 | static_address_id: model.id) 11 | 12 | dispatch_event(TRANSLATION_ADDED_STATIC_ADDRESS, model_hash) 13 | end 14 | 15 | def dispatch_deleted_item_events(model) 16 | dispatch_event(TRANSLATION_REMOVED_STATIC_ADDRESS, 17 | id: model.translation_id, 18 | static_address_id: model.id) 19 | end 20 | 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /vnet/lib/vnet/openflow/trema_tasks.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Openflow 4 | 5 | module TremaTasks 6 | 7 | attr_reader :trema_tasks 8 | 9 | def open_trema_tasks 10 | @trema_tasks = Trema::Tasks.new 11 | end 12 | 13 | def close_trema_tasks 14 | @trema_tasks.close 15 | end 16 | 17 | def pass_task(&blk) 18 | @trema_tasks.pass_task(&blk) 19 | end 20 | 21 | end 22 | 23 | end 24 | -------------------------------------------------------------------------------- /vnet/lib/vnet/rubygems.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | setup_rb = File.expand_path('../../../vendor/bundle/bundler/setup.rb', __FILE__) 4 | 5 | begin 6 | require 'rubygems' 7 | if File.exists?(setup_rb) 8 | load setup_rb 9 | else 10 | require 'bundler/setup' 11 | end 12 | rescue LoadError => e 13 | end 14 | -------------------------------------------------------------------------------- /vnet/lib/vnet/services/items.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | require 'ostruct' 4 | 5 | module Vnet::Services 6 | 7 | class Topology < OpenStruct 8 | end 9 | 10 | end 11 | -------------------------------------------------------------------------------- /vnet/lib/vnet/services/lease_policies/simple.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module Vnet::Services::LeasePolicies 4 | class Simple < Base 5 | def initialize(params) 6 | super 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /vnet/lib/vnet/services/lease_policy.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | require 'ostruct' 4 | 5 | module Vnet::Services 6 | 7 | # TODO: This class is currently not used. Make sure we have plans to extend and 8 | # use it, otherwise delete. 9 | class LeasePolicy < OpenStruct 10 | end 11 | 12 | end 13 | -------------------------------------------------------------------------------- /vnet/spec/config/common.conf: -------------------------------------------------------------------------------- 1 | registry { 2 | adapter "redis" 3 | host "127.0.0.1" 4 | port 6379 5 | } 6 | 7 | db { 8 | adapter "mysql2" 9 | host "localhost" 10 | database "vnet_test" 11 | port 3306 12 | user "root" 13 | password "" 14 | } 15 | -------------------------------------------------------------------------------- /vnet/spec/config/common2.conf: -------------------------------------------------------------------------------- 1 | registry { 2 | adapter "redis" 3 | host "127.0.0.1" 4 | port 6379 5 | } 6 | 7 | db { 8 | adapter "mysql" 9 | host "localhost" 10 | database "vnet_test" 11 | port 3306 12 | user "root" 13 | password "" 14 | } 15 | -------------------------------------------------------------------------------- /vnet/spec/config/vna.conf: -------------------------------------------------------------------------------- 1 | node { 2 | id "vna" 3 | addr { 4 | protocol "tcp" 5 | host "127.0.0.1" 6 | port 19103 7 | } 8 | } 9 | 10 | switch "tcp:172.16.50.2:6653" 11 | ovsdb "tcp:172.16.55.1:6666" 12 | -------------------------------------------------------------------------------- /vnet/spec/config/vnmgr.conf: -------------------------------------------------------------------------------- 1 | node { 2 | id "vnmgr" 3 | addr { 4 | protocol "tcp" 5 | host "127.0.0.1" 6 | port 19102 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /vnet/spec/config/webapi.conf: -------------------------------------------------------------------------------- 1 | node { 2 | id "webapi" 3 | addr { 4 | protocol "tcp" 5 | host "127.0.0.1" 6 | port 19101 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/datapath_network_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:datapath_network, class_name: Vnet::Models::DatapathNetwork) do 2 | id { id_sequence(:datapath_network_ids) } 3 | 4 | datapath_id { id_sequence(:datapath_ids) } 5 | network_id { id_sequence(:network_ids) } 6 | interface_id { id_sequence(:interface_ids) } 7 | ip_lease_id { id_sequence(:ip_lease_ids) } 8 | 9 | mac_address { Pio::Mac.new(id_sequence(:mac_address)) } 10 | end 11 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/datapath_route_link_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:datapath_route_link, class_name: Vnet::Models::DatapathRouteLink) do 2 | id { id_sequence(:datapath_route_link_ids) } 3 | 4 | datapath_id { id_sequence(:datapath_ids) } 5 | route_link_id { id_sequence(:route_link_ids) } 6 | interface_id { id_sequence(:interface_ids) } 7 | ip_lease_id { id_sequence(:ip_lease_ids) } 8 | 9 | mac_address { Pio::Mac.new(id_sequence(:mac_address)) } 10 | end 11 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/datapath_segment_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:datapath_segment, class_name: Vnet::Models::DatapathSegment) do 2 | id { id_sequence(:datapath_segment_ids) } 3 | 4 | datapath_id { id_sequence(:datapath_ids) } 5 | segment_id { id_sequence(:segment_ids) } 6 | interface_id { id_sequence(:interface_ids) } 7 | ip_lease_id { id_sequence(:ip_lease_ids) } 8 | 9 | mac_address { Pio::Mac.new(id_sequence(:mac_address)) } 10 | end 11 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/dns_record_fabricator.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | Fabricator(:dns_record, class_name: Vnet::Models::DnsRecord) do 3 | name "foo" 4 | ipv4_address IPAddr.new("192.168.1.10") 5 | end 6 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/dns_service_fabricator.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | Fabricator(:dns_service, class_name: Vnet::Models::DnsService) do 3 | network_service { 4 | Fabricate(:network_service_dns) 5 | } 6 | public_dns "8.8.8.8,8.8.4.4" 7 | end 8 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/filter_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:filter, class_name: Vnet::Models::Filter) do 2 | end 3 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/interface_assoc_fabricator.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | Fabricator(:interface_segment, class_name: Vnet::Models::InterfaceSegment) do 4 | end 5 | 6 | Fabricator(:interface_network, class_name: Vnet::Models::InterfaceNetwork) do 7 | end 8 | 9 | Fabricator(:interface_route_link, class_name: Vnet::Models::InterfaceRouteLink) do 10 | end 11 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/ip_address_fabricator.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | require 'ipaddress' 4 | 5 | Fabricator(:ip_address, class_name: Vnet::Models::IpAddress) do 6 | network { Fabricate(:network) } 7 | ipv4_address { sequence(:ipv4_address, IPAddress::IPv4.new("192.168.1.1").to_i) } 8 | end 9 | 10 | Fabricator(:ip_address_no_nw, class_name: Vnet::Models::IpAddress) do 11 | ipv4_address { sequence(:ipv4_address, IPAddress::IPv4.new("192.168.1.1").to_i) } 12 | end 13 | 14 | Fabricator(:ip_address_1, class_name: Vnet::Models::IpAddress) do 15 | ipv4_address 1 16 | end 17 | 18 | Fabricator(:ip_address_2, class_name: Vnet::Models::IpAddress) do 19 | ipv4_address 2 20 | end 21 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/ip_lease_container_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:ip_lease_container, class_name: Vnet::Models::IpLeaseContainer) do 2 | end 3 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/ip_range_fabricator.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | Fabricator(:ip_range, class_name: Vnet::Models::IpRange) do 4 | end 5 | 6 | Fabricator(:ip_range_with_range, class_name: Vnet::Models::IpRange) do 7 | begin_ipv4_address IPAddr.new("10.102.0.101").to_i 8 | end_ipv4_address IPAddr.new("10.102.0.110").to_i 9 | end 10 | 11 | Fabricator(:ip_range_with_range2, class_name: Vnet::Models::IpRange) do 12 | begin_ipv4_address IPAddr.new("192.168.100.10").to_i 13 | end_ipv4_address IPAddr.new("192.168.100.200").to_i 14 | end 15 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/ip_range_group_fabricator.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | Fabricator(:ip_range_group, class_name: Vnet::Models::IpRangeGroup) do 4 | allocation_type "incremental" 5 | end 6 | 7 | Fabricator(:ip_range_group_with_range, class_name: Vnet::Models::IpRangeGroup) do 8 | allocation_type "incremental" 9 | ip_ranges(count: 1) { Fabricate(:ip_range_with_range) } 10 | end 11 | 12 | Fabricator(:ip_range_group_with_range2, class_name: Vnet::Models::IpRangeGroup) do 13 | allocation_type "incremental" 14 | ip_ranges(count: 1) { Fabricate(:ip_range_with_range2) } 15 | end 16 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/ip_retention_container_fabricator.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | Fabricator(:ip_retention_container, class_name: Vnet::Models::IpRetentionContainer) do 4 | # id { id_sequence(:ip_retention_container) } 5 | 6 | lease_time 3600 7 | grace_time 1800 8 | end 9 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/ip_retention_fabricator.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | Fabricator(:ip_retention, class_name: Vnet::Models::IpRetention) do 4 | # id { id_sequence(:ip_retention) } 5 | end 6 | 7 | Fabricator(:ip_retention_with_ip_lease, class_name: Vnet::Models::IpRetention) do 8 | # id { id_sequence(:ip_retention) } 9 | 10 | ip_lease { Fabricate(:ip_lease) } 11 | end 12 | 13 | Fabricator(:ip_retention_with_container, class_name: Vnet::Models::IpRetention) do 14 | # id { id_sequence(:ip_retention) } 15 | 16 | ip_retention_container { Fabricate(:ip_retention_container) } 17 | end 18 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/lease_policy_base_interface_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:lease_policy_base_interface, class_name: Vnet::Models::LeasePolicyBaseInterface) do 2 | end 3 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/lease_policy_base_network_fabricator.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | Fabricator(:lease_policy_base_network, class_name: Vnet::Models::LeasePolicyBaseNetwork) do 4 | end 5 | 6 | Fabricator(:lease_policy_base_network_with_network, class_name: Vnet::Models::LeasePolicyBaseNetwork) do 7 | network { Fabricate(:network_for_range) } 8 | ip_range_group { Fabricate(:ip_range_group_with_range) } 9 | end 10 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/lease_policy_fabricator.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | Fabricator(:lease_policy, class_name: Vnet::Models::LeasePolicy) do 4 | mode "simple" 5 | timing "immediate" 6 | end 7 | 8 | Fabricator(:lease_policy_with_network, class_name: Vnet::Models::LeasePolicy) do 9 | mode "simple" 10 | timing "immediate" 11 | lease_policy_base_networks(count: 1) do 12 | Fabricate(:lease_policy_base_network_with_network) 13 | end 14 | ip_retention_containers(count:1) { Fabricate(:ip_retention_container) } 15 | end 16 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/lease_policy_ip_lease_container_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:lease_policy_ip_lease_container, class_name: Vnet::Models::LeasePolicyIpLeaseContainer) do 2 | end 3 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/lease_policy_ip_retention_container_fabricator.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:lease_policy_ip_retention_container, class_name: Vnet::Models::LeasePolicyIpRetentionContainer) do 2 | end 3 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/mac_address_fabricator.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | Fabricator(:mac_address, class_name: Vnet::Models::MacAddress) do 4 | mac_address { MacAddr.new(sequence(:mac_address, 1)) } 5 | end 6 | 7 | Fabricator(:mac_address_no_seg, class_name: Vnet::Models::MacAddress) do 8 | mac_address { MacAddr.new(sequence(:mac_address, 1)) } 9 | end 10 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/mac_range_fabricator.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | Fabricator(:mac_range, class_name: Vnet::Models::MacRange) do 4 | id { id_sequence(:mac_range_ids) } 5 | end 6 | 7 | Fabricator(:mac_range_with_range, class_name: Vnet::Models::MacRange) do 8 | id { id_sequence(:mac_range_ids) } 9 | 10 | begin_mac_address MacAddr.new("08:00:10:aa:00:00").to_i 11 | end_mac_address MacAddr.new("08:00:10:aa:ff:ff").to_i 12 | end 13 | 14 | Fabricator(:mac_range_with_range2, class_name: Vnet::Models::MacRange) do 15 | id { id_sequence(:mac_range_ids) } 16 | 17 | begin_mac_address MacAddr.new("08:00:20:aa:00:00").to_i 18 | end_mac_address MacAddr.new("08:00:20:aa:ff:ff").to_i 19 | end 20 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/mac_range_group_fabricator.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | Fabricator(:mac_range_group, class_name: Vnet::Models::MacRangeGroup) do 4 | id { id_sequence(:mac_range_group_ids) } 5 | 6 | allocation_type "random" 7 | end 8 | 9 | Fabricator(:mac_range_group_with_range, class_name: Vnet::Models::MacRangeGroup) do 10 | id { id_sequence(:mac_range_group_ids) } 11 | 12 | allocation_type "random" 13 | mac_ranges(count: 1) { Fabricate(:mac_range_with_range) } 14 | end 15 | 16 | Fabricator(:mac_range_group_with_range2, class_name: Vnet::Models::MacRangeGroup) do 17 | id { id_sequence(:mac_range_group_ids) } 18 | 19 | allocation_type "random" 20 | mac_ranges(count: 1) { Fabricate(:mac_range_with_range2) } 21 | end 22 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/network_service_fabricator.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | Fabricator(:network_service, class_name: Vnet::Models::NetworkService) do 3 | mode 'dhcp' 4 | end 5 | 6 | Fabricator(:network_service_dhcp, class_name: Vnet::Models::NetworkService) do 7 | mode 'dhcp' 8 | end 9 | 10 | Fabricator(:network_service_dns, class_name: Vnet::Models::NetworkService) do 11 | mode 'dns' 12 | end 13 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/route_fabricator.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | require 'ipaddr' 4 | 5 | Fabricator(:route, class_name: Vnet::Models::Route) do 6 | id { id_sequence(:route_ids) } 7 | interface { Fabricate(:interface) } 8 | route_link { Fabricate(:route_link) } 9 | ipv4_network IPAddr.new("192.168.2.0").to_i 10 | ipv4_prefix 24 11 | end 12 | 13 | Fabricator(:route_free, class_name: Vnet::Models::Route) do 14 | id { id_sequence(:route_ids) } 15 | ipv4_network IPAddr.new("192.168.2.0").to_i 16 | ipv4_prefix 24 17 | end 18 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/route_link_fabricator.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | require 'ipaddr' 4 | 5 | Fabricator(:route_link, class_name: Vnet::Models::RouteLink) do 6 | id { id_sequence(:route_link_ids) } 7 | mac_address { sequence(:mac_address, 100) } 8 | end 9 | 10 | Fabricator(:route_link_1, class_name: Vnet::Models::RouteLink) do 11 | id { id_sequence(:route_link_ids) } 12 | uuid "rl-aaaaaaaa" 13 | mac_address { sequence(:mac_address, 101) } 14 | end 15 | 16 | Fabricator(:route_link_2, class_name: Vnet::Models::RouteLink) do 17 | id { id_sequence(:route_link_ids) } 18 | uuid "rl-bbbbbbbb" 19 | mac_address { sequence(:mac_address, 102) } 20 | end 21 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/segment_fabricator.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | Fabricator(:segment, class_name: Vnet::Models::Segment) do 4 | id { id_sequence(:segment_ids) } 5 | end 6 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/translation.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:translation, class_name: Vnet::Models::Translation) do 2 | id { id_sequence(:translation_ids) } 3 | mode 'static_address' 4 | end 5 | -------------------------------------------------------------------------------- /vnet/spec/fabricators/translation_static_address.rb: -------------------------------------------------------------------------------- 1 | Fabricator(:translation_static_address, class_name: Vnet::Models::TranslationStaticAddress) do 2 | id { id_sequence(:translation_static_address_ids) } 3 | end 4 | 5 | -------------------------------------------------------------------------------- /vnet/spec/helpers/item.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | RSpec::Matchers.define :be_item_with_assoc_count do |assoc_name, expected_count| 4 | match do |item| 5 | item.send(assoc_name).count == expected_count 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /vnet/spec/helpers/manager_event.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | RSpec::Matchers.define :be_manager_with_no_events do 4 | match do |manager| 5 | manager.instance_variable_get(:@event_queues).empty? 6 | end 7 | end 8 | 9 | RSpec::Matchers.define :be_manager_with_event_handler_state do |expected| 10 | match do |manager| 11 | manager.instance_variable_get(:@event_handler_state) == expected 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /vnet/spec/helpers/model.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | RSpec::Matchers.define :be_model_and_include do |expected_params| 4 | match do |actual| 5 | next unless actual.is_a? Vnet::Models::Base 6 | 7 | expected_params.all? { |key, value| 8 | actual.respond_to?(key) && actual.send(key) == value 9 | } 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /vnet/spec/log/.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | -------------------------------------------------------------------------------- /vnet/spec/support/let_helper.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # TODO: Replaced. 4 | 5 | def let_permutation(lets, permutation, postfix) 6 | result = lets.select.with_index { |name, index| 7 | permutation[index] 8 | }.map { |name, index| 9 | "#{name}#{postfix}" 10 | } 11 | end 12 | 13 | def let_context(permutation, let_ids: []) 14 | result = let_permutation(let_ids, permutation, '.id') 15 | 16 | if result.empty? 17 | 'no lets' 18 | else 19 | result.join(' and ') 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /vnet/spec/support/mock_port_manager.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | class MockPortManager < Vnet::Core::PortManager 3 | 4 | def ports 5 | @items 6 | end 7 | 8 | end 9 | -------------------------------------------------------------------------------- /vnet/spec/support/mock_switch.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | class MockSwitch < Vnet::Openflow::Switch 4 | end 5 | -------------------------------------------------------------------------------- /vnet/spec/support/mock_vnet_info.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | class MockEmptyVnetInfo < Vnet::Services::VnetInfo 4 | def initialize 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /vnet/spec/vnet/configurations/vnmgr_spec.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | require 'spec_helper' 3 | 4 | describe Vnet::Configurations::Vnmgr do 5 | let(:config_path) { File.join(Vnet::ROOT, "spec/config") } 6 | 7 | before do 8 | allow(Vnet::Configurations::Vnmgr).to receive(:paths).and_return([config_path]) 9 | end 10 | 11 | describe "param" do 12 | subject { Vnet::Configurations::Vnmgr.load } 13 | it { expect(subject.node.id).to eq "vnmgr" } 14 | it { expect(subject.node.addr.protocol).to eq "tcp" } 15 | it { expect(subject.node.addr.host).to eq "127.0.0.1" } 16 | it { expect(subject.node.addr.port).to eq 19102 } 17 | it { expect(subject.node.addr_string).to eq "tcp://127.0.0.1:19102" } 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /vnet/spec/vnet/configurations/webapi_spec.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | require 'spec_helper' 3 | 4 | describe Vnet::Configurations::Webapi do 5 | let(:config_path) { File.join(Vnet::ROOT, "spec/config") } 6 | 7 | before do 8 | allow(Vnet::Configurations::Webapi).to receive(:paths).and_return([config_path]) 9 | end 10 | 11 | describe "param" do 12 | subject { Vnet::Configurations::Webapi.load } 13 | it { expect(subject.node.id).to eq "webapi" } 14 | it { expect(subject.node.addr.protocol).to eq "tcp" } 15 | it { expect(subject.node.addr.host).to eq "127.0.0.1" } 16 | it { expect(subject.node.addr.port).to eq 19101 } 17 | it { expect(subject.node.addr_string).to eq "tcp://127.0.0.1:19101" } 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /vnet/spec/vnet/endpoints/1.0/matchers/helper_methods.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | module EndpointMatcherHelper 4 | def verify_message(expected, actual) 5 | case expected 6 | when nil 7 | true 8 | when Regexp 9 | expected =~ actual 10 | else 11 | expected == actual 12 | end 13 | end 14 | 15 | def print_response(response) 16 | "Http status: #{response.status}\n" + 17 | "Body: #{response.body.split(/\n/).slice(0, 100).join("\n")}\n" + 18 | (response.errors.empty? ? "" : "Stacktrace:\n #{response.errors}") 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /vnet/spec/vnet/endpoints/1.0/shared_examples/helper_methods.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | def it_should_return_error(code, name, message = nil) 4 | it "should return a #{code} error (#{name})" do 5 | expect(last_response).to fail.with_code(code).with_error(name, message) 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /vnet/spec/vnet/endpoints/1.0/shared_examples/interface_assoc.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | shared_examples 'interface assoc on endpoints' do |other_name| 4 | 5 | describe "Many to many relation calls for #{other_name}s" do 6 | let!(:base_object) { Fabricate(fabricator) } 7 | let(:relation_fabricator) { other_name } 8 | let(:join_table_fabricator) { "interface_#{other_name}".to_sym } 9 | 10 | let!(:interface) { Fabricate(:interface) { uuid 'if-test' } } 11 | 12 | accepted_params = { 13 | static: true 14 | } 15 | 16 | include_examples 'PUT many_to_many_relation', "#{other_name}s", accepted_params 17 | include_examples 'PUT many_to_many_relation', "#{other_name}s", { static: false }, [:static] 18 | end 19 | 20 | end 21 | -------------------------------------------------------------------------------- /vnet/spec/vnet/endpoints/1.0/shared_examples/uuid_in_param.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | shared_examples "uuid_in_param" do |accepted_params, uuid_param| 4 | context "with a '#{uuid_param}' with a faulty syntax" do 5 | let(:request_params) { accepted_params.dup.tap {|n| n[uuid_param] = "faulty_uuid"} } 6 | 7 | it_should_return_error(400, "InvalidUUID", /faulty_uuid$/) 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /vnet/spec/vnet/event/dispachable_spec.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | require 'spec_helper' 3 | 4 | class TestDispatcher 5 | include Vnet::Event::Dispatchable 6 | end 7 | 8 | describe Vnet::Event::Dispatchable do 9 | let(:dispatcher){ TestDispatcher.new } 10 | let(:handler){ MockEventHandler.new } 11 | 12 | before do 13 | Vnet::Event::Dispatchable.event_handler = handler 14 | dispatcher.dispatch_event("interface/created", {id: 3}) 15 | end 16 | 17 | describe "dispatch_event" do 18 | subject { handler.handled_events } 19 | it { expect(subject.size).to eq 1 } 20 | it { expect(subject[0][:event]).to eq "interface/created" } 21 | it { expect(subject[0][:options][:id]).to eq 3 } 22 | end 23 | 24 | end 25 | -------------------------------------------------------------------------------- /vnet/spec/vnet/model_wrappers/network_spec.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | require 'spec_helper' 3 | 4 | describe Vnet::ModelWrappers::Network do 5 | let(:network) do 6 | Fabricate(:network, :ip_addresses => [Fabricate(:ip_address)]) 7 | end 8 | 9 | context "with real proxy" do 10 | subject { Vnet::ModelWrappers::Network.batch[network.canonical_uuid].ip_addresses.first.commit } 11 | it { expect(subject).to be_a Vnet::ModelWrappers::IpAddress } 12 | it { expect(subject.id).to eq network.ip_addresses.first.id } 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /vnet/spec/vnet/node_api/ip_retention_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe Vnet::NodeApi::IpRetention do 4 | end 5 | -------------------------------------------------------------------------------- /vnet/spec/vnet/node_modules/rpc_spec.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | require 'spec_helper' 3 | 4 | describe Vnet::NodeModules::Rpc do 5 | before(:each) do 6 | allow(Vnet::Models::Network).to receive(:all).and_return([{uuid: "test-uuid"}]) 7 | end 8 | 9 | subject do 10 | Vnet::NodeModules::Rpc.new.execute(:network, :all) 11 | end 12 | 13 | it { should be_a Array } 14 | it { expect(subject.size).to eq 1 } 15 | it { expect(subject.first).to be_a Hash } 16 | it { expect(subject.first[:uuid]).to eq "test-uuid" } 17 | end 18 | -------------------------------------------------------------------------------- /vnet/spec/vnet/node_modules/service_openflow_spec.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | require 'spec_helper' 3 | 4 | describe Vnet::NodeModules::ServiceOpenflow do 5 | end 6 | --------------------------------------------------------------------------------