├── .gitignore └── c3po-ngic.cfg ├── LICENSE ├── README.txt ├── ansible ├── ansible.cfg ├── cleanup.yml ├── group_vars │ ├── all │ ├── all.bak │ ├── c3po.yml │ ├── prephost.yml │ ├── repo.yml │ └── sgx.yml ├── inventory ├── main.yml ├── playbooks │ ├── cleanup.yml │ ├── common.yml │ ├── control_plane.yml │ ├── data_plane.yml │ ├── prephost.yml │ └── sgx_host_pre.yml ├── readme.txt ├── roles │ ├── ansible │ │ └── tasks │ │ │ └── main.yml │ ├── cdf │ │ ├── files │ │ │ ├── Makefile │ │ │ └── ansible_c3po_install.sh │ │ ├── tasks │ │ │ └── main.yml │ │ ├── templates │ │ │ └── cdf.conf.j2 │ │ └── vars │ │ │ └── main.yml │ ├── cleanup │ │ └── tasks │ │ │ └── main.yml │ ├── common │ │ └── tasks │ │ │ └── main.yml │ ├── ctf │ │ ├── files │ │ │ ├── Makefile │ │ │ └── ansible_c3po_install.sh │ │ ├── tasks │ │ │ └── main.yml │ │ ├── templates │ │ │ ├── ctf.conf.j2 │ │ │ ├── ctf.json.j2 │ │ │ └── test.j2 │ │ └── vars │ │ │ └── main.yml │ ├── db │ │ ├── handlers │ │ │ └── main.yml │ │ ├── tasks │ │ │ └── main.yml │ │ ├── templates │ │ │ ├── cassandra-rackdc.j2 │ │ │ ├── cassandra.j2 │ │ │ └── data_provisioning_users.j2 │ │ └── vars │ │ │ └── main.yml │ ├── dns │ │ ├── files │ │ │ ├── default_bind │ │ │ └── named.conf.options │ │ ├── handlers │ │ │ └── main.yml │ │ ├── tasks │ │ │ └── main.yml │ │ ├── templates │ │ │ ├── db_forwarder.j2 │ │ │ ├── db_reverse.j2 │ │ │ └── named.conf.local.j2 │ │ └── vars │ │ │ └── main.yml │ ├── fpc │ │ ├── files │ │ │ └── fpc_install_wo_menu.sh │ │ ├── tasks │ │ │ └── main.yml │ │ ├── templates │ │ │ └── new_run.j2 │ │ └── vars │ │ │ └── main.yml │ ├── hss │ │ ├── files │ │ │ ├── Makefile │ │ │ └── ansible_c3po_install.sh │ │ ├── tasks │ │ │ └── main.yml │ │ ├── templates │ │ │ ├── hss-conf.j2 │ │ │ └── hss-json.j2 │ │ └── vars │ │ │ └── main.yml │ ├── kvm │ │ └── tasks │ │ │ └── main.yml │ ├── mme │ │ ├── files │ │ │ ├── Makefile │ │ │ ├── ansible_c3po_install.sh │ │ │ ├── install.sh │ │ │ └── interfaces-mme │ │ ├── tasks │ │ │ └── main.yml │ │ ├── templates │ │ │ ├── vbfd-conf.j2 │ │ │ └── vbsm_cfg-txt.j2 │ │ └── vars │ │ │ └── main.yml │ ├── pgwc │ │ ├── files │ │ │ ├── build.sh │ │ │ ├── install_new.sh.org │ │ │ └── install_pgwc.sh │ │ ├── tasks │ │ │ └── main.yml │ │ ├── templates │ │ │ ├── cp_config.j2 │ │ │ ├── interface.j2 │ │ │ ├── ng-core_cfg.j2 │ │ │ ├── pgwc.service.j2 │ │ │ ├── run_pgwc.j2 │ │ │ └── spgwc │ │ └── vars │ │ │ └── main.yml │ ├── pgwu │ │ ├── files │ │ │ ├── Makefile │ │ │ └── install_new.sh │ │ ├── tasks │ │ │ └── main.yml │ │ ├── templates │ │ │ ├── Makefile.j2 │ │ │ ├── Makefile1.j2 │ │ │ ├── ansible_install_pgwu.j2 │ │ │ ├── build.j2 │ │ │ ├── dp_config.j2 │ │ │ ├── interface.j2 │ │ │ └── ng-core_cfg.j2 │ │ └── vars │ │ │ └── main.yml │ ├── sgwc │ │ ├── files │ │ │ ├── build.sh │ │ │ ├── install_new.sh.org │ │ │ └── install_sgwc.sh │ │ ├── tasks │ │ │ └── main.yml │ │ ├── templates │ │ │ ├── cp_config.j2 │ │ │ ├── interface.j2 │ │ │ ├── ng-core_cfg.j2 │ │ │ ├── run_sgwc.j2 │ │ │ ├── sgwc │ │ │ └── sgwc.service.j2 │ │ └── vars │ │ │ └── main.yml │ ├── sgwu │ │ ├── files │ │ │ ├── Makefile │ │ │ └── install_new.sh │ │ ├── tasks │ │ │ └── main.yml │ │ ├── templates │ │ │ ├── Makefile.j2 │ │ │ ├── Makefile1.j2 │ │ │ ├── ansible_install_sgwu.j2 │ │ │ ├── build.j2 │ │ │ ├── dp_config.j2 │ │ │ ├── interface.j2 │ │ │ └── ng-core_cfg.j2 │ │ └── vars │ │ │ └── main.yml │ ├── sgx-dealer-in │ │ ├── tasks │ │ │ └── main.yml │ │ ├── templates │ │ │ ├── dealer_install.sh │ │ │ ├── dealer_json.j2 │ │ │ └── deps_install.sh │ │ └── vars │ │ │ └── main.yml │ ├── sgx-dealer-out │ │ ├── tasks │ │ │ └── main.yml │ │ ├── templates │ │ │ ├── dealer.json │ │ │ ├── dealer_install.sh │ │ │ ├── dealer_json.j2 │ │ │ └── deps_install.sh │ │ └── vars │ │ │ └── main.yml │ ├── sgx-kms │ │ ├── meta.bak │ │ │ └── main.yml │ │ ├── tasks │ │ │ └── main.yml │ │ ├── templates │ │ │ ├── deps_install.sh │ │ │ ├── kms_install.sh │ │ │ └── kms_json.j2 │ │ └── vars │ │ │ └── main.yml │ ├── sgx-router │ │ ├── tasks │ │ │ └── main.yml │ │ └── vars │ │ │ └── main.yml │ ├── sgx_host_pre │ │ └── tasks │ │ │ └── main.yml │ ├── spgwc │ │ ├── files │ │ │ ├── build.sh │ │ │ ├── install_new.sh │ │ │ └── install_new.sh.org │ │ ├── tasks │ │ │ └── main.yml │ │ ├── templates │ │ │ ├── cp_config.j2 │ │ │ ├── interface.j2 │ │ │ ├── ng-core_cfg.j2 │ │ │ ├── run_spgwc.j2 │ │ │ ├── spgwc │ │ │ └── spgwc.service.j2 │ │ └── vars │ │ │ └── main.yml │ ├── spgwu │ │ ├── files │ │ │ ├── Makefile │ │ │ └── install_new.sh │ │ ├── tasks │ │ │ └── main.yml │ │ ├── templates │ │ │ ├── Makefile.j2 │ │ │ ├── Makefile1.j2 │ │ │ ├── ansible_install_spgwu.j2 │ │ │ ├── build.j2 │ │ │ ├── dp_config.j2 │ │ │ ├── interface.j2 │ │ │ └── ng-core_cfg.j2 │ │ └── vars │ │ │ └── main.yml │ └── terraform_setup │ │ └── tasks │ │ └── main.yml ├── sgx_host_pre.yml ├── sgx_inv └── site.yml ├── c3po_ngic_input.cfg ├── deploy.sh ├── destroy.sh ├── scripts ├── check_connectivity.py ├── check_duplicate_networks.py ├── get_vm_ip.sh ├── listvfs_by_pf.sh ├── prerequisite.sh └── sshvm.sh ├── setupremote ├── cleanup.sh ├── prerequisite.sh ├── run.sh └── scripts │ ├── check_connectivity_spgw.py │ ├── check_vms.py │ ├── check_vms_constants.py │ ├── collect_host_inv.py │ ├── constants.py │ ├── constants_spgw.py │ └── show_progress.sh └── terraform ├── .terraform └── plugins │ └── linux_amd64 │ └── lock.json ├── autogen_new.cfg ├── c3povm_defs.cfg ├── c3povm_defs.cfg.blank ├── common.tf ├── db_vm.tf ├── fpc_vm.tf ├── host_type.cfg ├── hss_vm.tf ├── il_nperf_vm.tf ├── input.tfvars ├── interfaces-db ├── interfaces-fpc ├── interfaces-hss ├── interfaces-mme ├── interfaces-spgwc ├── interfaces-spgwu ├── mme_vm.tf ├── network_map.tfvars ├── pgwc_vm.tf ├── pgwu_vm.tf ├── sample_ngic_configurations ├── pgwc │ ├── cp_config.cfg │ └── interface.cfg ├── pgwu │ ├── dp_config.cfg │ └── interface.cfg ├── sgwc │ ├── cp_config.cfg │ └── interface.cfg └── sgwu │ ├── cp_config.cfg │ ├── dp_config.cfg │ └── interface.cfg ├── scripts ├── constants.py ├── host_validation.sh ├── lib │ ├── ask2continue.sh │ └── parseoptions.sh ├── network_creation.sh ├── network_mapping.sh └── parse_ini_input.py ├── sgwc_vm.tf ├── sgwu_vm.tf ├── spgwc_vm.tf ├── spgwu_vm.tf ├── terraform-provider-libvirt └── variables.tf /ansible/cleanup.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # file: cleanup.yml 3 | - import_playbook: playbooks/cleanup.yml 4 | 5 | -------------------------------------------------------------------------------- /ansible/group_vars/all: -------------------------------------------------------------------------------- 1 | --- 2 | githubuser: "" 3 | githubpassword: "" 4 | MME_S6A_IP: "10.0.3.10" 5 | MME_S11_IP: "10.0.2.20" 6 | MME_S1MME_IP: "10.0.1.30" 7 | HSS_S6A_IP: "10.0.3.40" 8 | HSS_DB_IP: "10.0.4.50" 9 | DB_DB_IP: "10.0.4.60" 10 | SPGWC_S11_IP: "10.0.2.70" 11 | SPGWC_FPCNB_IP: "10.0.7.80" 12 | SPGWC_S5S8_SGWC_IP: "10.0.5.90" 13 | FPC_FPCNB_IP: "10.0.7.100" 14 | FPC_FPCSB_IP: "10.0.8.110" 15 | SPGWU_FPCSB_IP: "10.0.8.120" 16 | SPGWU_S1U_IP: "10.0.9.130" 17 | SPGWU_SGI_IP: "10.0.10.140" 18 | SGX_DLRIN_SGX_DLRIN_IP: "10.212.93.73" 19 | SGX_DLRRTR_SGX_DLRRTR_IP: "10.212.93.73" 20 | SGX_DLROUT_SGX_DLROUT_IP: "10.212.93.73" 21 | SGX_KMS_SGX_KMS_IP: "10.212.93.73" 22 | CTF_CTF_RF_IP: "10.212.93.73" 23 | CDF_CDF_RF_IP: "10.212.93.73" 24 | DNS_DDNS_IP: "10.212.93.73" 25 | -------------------------------------------------------------------------------- /ansible/group_vars/all.bak: -------------------------------------------------------------------------------- 1 | --- 2 | githubuser: "" 3 | githubpassword: "" 4 | MME_S6A_IP: 10.0.3.10 5 | MME_S11_IP: 10.0.2.20 6 | MME_S1MME_IP: 10.0.1.30 7 | 8 | HSS_S6A_IP: 192.168.110.61 9 | HSS_DB_IP: 192.168.112.61 10 | 11 | DB_IP: 192.168.112.60 12 | 13 | SPGWC_S11_IP: 10.0.2.70 14 | SPGWC_FPCNB_IP: 10.0.7.80 15 | SPGWC_S5S8_SGWC_IP: 10.0.5.90 16 | 17 | SGWC_S11_IP: 10.0.2.70 18 | SGWC_FPCNB_IP: 10.0.7.80 19 | SGWC_S5S8_SGWC_IP: 10.0.5.90 20 | 21 | PGWC_S5S8_PGWC_IP: 10.5.20.61 22 | PGWC_FPCNB_IP: 192.168.125.61 23 | 24 | FPC_FPCNB_IP: 10.0.7.100 25 | FPC_FPCSB_IP: 10.0.8.110 26 | 27 | SPGWU_FPCSB_IP: 192.168.125.80 28 | SPGWU_S1U_IP: 11.1.1.93 29 | SPGWU_SGI_IP: 13.1.1.93 30 | 31 | SGWU_FPCSB_IP: 192.168.125.80 32 | SGWU_S1U_IP: 11.1.1.93 33 | SGWU_S5S8_SGWU_IP: 12.1.1.93 34 | 35 | PGWU_FPCSB_IP: 192.168.125.81 36 | PGWU_S5S8_PGWU_IP: 14.1.1.93 37 | PGWU_SGI_IP: 13.1.1.93 38 | 39 | DEALER_IN_IP: 10.212.93.78 40 | -------------------------------------------------------------------------------- /ansible/group_vars/c3po.yml: -------------------------------------------------------------------------------- 1 | --- 2 | HOST_NAME: "ns1" 3 | DOMAIN: "test3gpp.net" 4 | DNS_TYPE: "distributed" 5 | WITH_FPC: "no" 6 | HSS_OPTKEY: "63bfa50ee6523365ff14c1f45f88737d" 7 | ORIGIN: "openair4G.eur" 8 | HSS_ORIGIN_HOST: "hss.openair4G.eur" 9 | CASS_USR: "root" 10 | CASS_PWD: "root" 11 | CASS_DB: "vhss" 12 | 13 | VBSM_ENB_ADDR_1: "10.0.10.1" 14 | VBSM_MME_S1AP_IPADDR: "10.0.10.20" 15 | VBSM_MME_EGTP_IPADDR: "10.1.10.22" 16 | VBSM_PGW_IPADDR: "192.168.1.105" 17 | VBSM_UE_NUM: "40000" 18 | VBSM_MCC_DIG1: "2" 19 | VBSM_MCC_DIG2: "0" 20 | VBSM_MCC_DIG3: "8" 21 | VBSM_MNC_DIG1: "0" 22 | VBSM_MNC_DIG2: "1" 23 | VBSM_MNC_DIG3: "-1" 24 | VBSM_TARGET_MME_PLMN_ID: "31310f" 25 | VBSM_TARGET_MME_IP_ADDR: "192.25.1.195" 26 | VBSM_SGSN_IP_ADDR: "192.25.1.195" 27 | VBSM_SGSN_PLMN_ID: "31311f" 28 | VBSM_MME_NAME: "vmmestandalone" 29 | VBSM_MAX_ENB: "2" 30 | VBSM_MMECODE: "1" 31 | VBSM_MMEGRPID: "1" 32 | -------------------------------------------------------------------------------- /ansible/group_vars/prephost.yml: -------------------------------------------------------------------------------- 1 | --- 2 | tr_repo_url : "ilpm.intel-research.net/bitbucket/scm/vccbbw/terraform_ngic_deployment.git" 3 | tr_repo_dir : "/opt" 4 | 5 | #ansible_ssh_user : "root" 6 | #ansible_ssh_pass : "12345678" 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /ansible/group_vars/repo.yml: -------------------------------------------------------------------------------- 1 | --- 2 | C3PO_REPO: "https://github.com/omec-project/c3po.git" 3 | NGIC_REPO: "https://github.com/omec-project/ngic-rtc.git" 4 | MME_REPO: "https://github.com/omec-project/openmme.git" 5 | FREEDIAMETER_REPO: "https://github.com/omec-project/freediameter.git" 6 | # ODL_REPO: "" 7 | TR_REPO: "https://github.com/omec-project/deployment.git" 8 | SGX_REPO: "https://github.com/omec-project/c3po.git" 9 | 10 | C3PO_REPO_DIR: "/opt/c3po" 11 | MME_REPO_DIR: "/opt/openmme" 12 | FREEDIAMETER_DIR: "{{ MME_REPO_DIR }}/modules/freediameter" 13 | NGIC_REPO_DIR: "/opt/ngic-rtc" 14 | ODL_REPO_DIR: "/opt/netty_odl_fpc" 15 | TR_REPO_DIR: "/opt/deployment" 16 | 17 | MME_COMMIT_ID: "cbefb0950b324e21a0922cc1c654a186c68cd5ba" 18 | NGIC_COMMIT_ID: "7200ac1d515ea775c0896aa432e29ff7bd0ff5fa" 19 | C3PO_COMMIT_ID: "9620438a774bc1e47cdb830c2f0a220c2294ab61" 20 | ODL_COMMIT_ID: "d6608df8dbc5c2d840d74590fc4750acca715429" 21 | SGX_COMMIT_ID: "82539248739bd069959b15ad37e9bc4f09c67f86" 22 | -------------------------------------------------------------------------------- /ansible/group_vars/sgx.yml: -------------------------------------------------------------------------------- 1 | --- 2 | SGX_BUILD: "false" 3 | KEY_NAME_SPACE: "dealer_namespace" 4 | KMS_PORT: "50443" 5 | CDR_IN_PORT: "6789" 6 | CDR_OUT_PORT: "6790" 7 | DL_IN_PORT: "51443" 8 | DL_OUT_PORT: "52443" 9 | SGX_VERSION: "1.9" 10 | SGX_DRIVER_LINK: "https://download.01.org/intel-sgx/linux-{{ SGX_VERSION }}/sgx_linux_x64_driver_3abcf82.bin" 11 | SGX_PLATFORM_LINK: "https://download.01.org/intel-sgx/linux-{{ SGX_VERSION }}/sgx_linux_ubuntu16.04.1_x64_psw_1.9.100.39124.bin" 12 | SGX_SDK_LINK: "https://download.01.org/intel-sgx/linux-{{ SGX_VERSION }}/sgx_linux_ubuntu16.04.1_x64_sdk_1.9.100.39124.bin" 13 | DEPS_DIR: "/opt/tmp" 14 | ISVSVN: "0" 15 | CTF_ARCHIEVE_PATH: "test/data/archive" 16 | CTF_TRACK_PATH: "test/data/tracking" 17 | CTF_LOG_PATH: "logs" 18 | 19 | -------------------------------------------------------------------------------- /ansible/inventory: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omec-project/deployment/18ae3b2d11b073b50f92ab279f61605fd22b776e/ansible/inventory -------------------------------------------------------------------------------- /ansible/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - import_playbook: playbooks/prephost.yml 3 | -------------------------------------------------------------------------------- /ansible/playbooks/cleanup.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: cleaning target Hosts 3 | hosts: all 4 | become: yes 5 | become_method: sudo 6 | vars_files: 7 | - "../group_vars/prephost.yml" 8 | - "../group_vars/repo.yml" 9 | roles: 10 | - cleanup 11 | -------------------------------------------------------------------------------- /ansible/playbooks/common.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Appling common changes 3 | hosts: all 4 | become: yes 5 | become_method: sudo 6 | roles: 7 | - common 8 | 9 | -------------------------------------------------------------------------------- /ansible/playbooks/control_plane.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Installation and configuration of mme 3 | hosts: mme 4 | become: yes 5 | become_method: sudo 6 | vars_files: 7 | - "../group_vars/c3po.yml" 8 | - "../group_vars/repo.yml" 9 | roles: 10 | - mme 11 | tags: 12 | - mme 13 | - name: Installation and configuration of hss 14 | hosts: hss 15 | become: yes 16 | become_method: sudo 17 | vars_files: 18 | - "../group_vars/c3po.yml" 19 | - "../group_vars/repo.yml" 20 | roles: 21 | - hss 22 | tags: 23 | - hss 24 | - name: Installation and configuration of db 25 | hosts: db 26 | become: yes 27 | become_method: sudo 28 | vars_files: 29 | - "../group_vars/repo.yml" 30 | roles: 31 | - db 32 | tags: 33 | - db 34 | - name: Installation and configuration of spgwc 35 | hosts: spgwc 36 | become: yes 37 | become_method: sudo 38 | vars_files: 39 | - "../group_vars/repo.yml" 40 | - "../group_vars/c3po.yml" 41 | roles: 42 | - spgwc 43 | tags: 44 | - spgwc 45 | - name: Installation and configuration of FPC 46 | hosts: fpc 47 | become: yes 48 | become_method: sudo 49 | vars_files: 50 | - "../group_vars/repo.yml" 51 | roles: 52 | - fpc 53 | tags: 54 | - fpc 55 | #----------------------------------------------- 56 | - name: Installation and configuration of sgwc 57 | hosts: sgwc 58 | become: yes 59 | become_method: sudo 60 | vars_files: 61 | - "../group_vars/repo.yml" 62 | - "../group_vars/c3po.yml" 63 | roles: 64 | - sgwc 65 | tags: 66 | - sgwc 67 | 68 | - hosts: pgwc 69 | become: yes 70 | become_method: sudo 71 | vars_files: 72 | - "../group_vars/repo.yml" 73 | - "../group_vars/c3po.yml" 74 | roles: 75 | - pgwc 76 | tags: 77 | - pgwc 78 | -------------------------------------------------------------------------------- /ansible/playbooks/data_plane.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: SGX-DEALER-IN setup 3 | hosts: sgx-dealer-in 4 | gather_facts: true 5 | become: yes 6 | become_method: sudo 7 | vars_files: 8 | - "../group_vars/prephost.yml" 9 | - "../group_vars/sgx.yml" 10 | - "../group_vars/repo.yml" 11 | roles: 12 | - sgx-dealer-in 13 | tags: 14 | - sgx-dealer-in 15 | - name: SGX-DEALER-OUT setup 16 | hosts: sgx-dealer-out 17 | gather_facts: true 18 | become: yes 19 | become_method: sudo 20 | vars_files: 21 | - "../group_vars/prephost.yml" 22 | - "../group_vars/sgx.yml" 23 | - "../group_vars/repo.yml" 24 | roles: 25 | - sgx-dealer-out 26 | tags: 27 | - sgx-dealer-out 28 | - name: SGX-KMS setup 29 | hosts: sgx-kms 30 | gather_facts: true 31 | become: yes 32 | become_method: sudo 33 | vars_files: 34 | - "../group_vars/prephost.yml" 35 | - "../group_vars/sgx.yml" 36 | - "../group_vars/repo.yml" 37 | roles: 38 | - sgx-kms 39 | tags: 40 | - sgx-kms 41 | - name: SGX-ROUTER setup 42 | hosts: sgx-router 43 | gather_facts: true 44 | become: yes 45 | become_method: sudo 46 | vars_files: 47 | - "../group_vars/prephost.yml" 48 | - "../group_vars/sgx.yml" 49 | - "../group_vars/repo.yml" 50 | roles: 51 | - sgx-router 52 | tags: 53 | - sgx-router 54 | - name: Installation and configuration of DNS 55 | hosts: dns 56 | become: yes 57 | become_method: sudo 58 | vars_files: 59 | - "../group_vars/prephost.yml" 60 | - "../group_vars/c3po.yml" 61 | roles: 62 | - dns 63 | tags: 64 | - dns 65 | - name: Installation and configuration of CTF 66 | hosts: ctf 67 | vars_files: 68 | - "../group_vars/prephost.yml" 69 | - "../group_vars/c3po.yml" 70 | - "../group_vars/sgx.yml" 71 | - "../group_vars/repo.yml" 72 | become: yes 73 | become_method: sudo 74 | roles: 75 | - ctf 76 | tags: 77 | - ctf 78 | - name: Installation and configuration of CDF 79 | hosts: cdf 80 | become: yes 81 | become_method: sudo 82 | vars_files: 83 | - "../group_vars/c3po.yml" 84 | - "../group_vars/prephost.yml" 85 | - "../group_vars/repo.yml" 86 | roles: 87 | - cdf 88 | tags: 89 | - cdf 90 | 91 | - name: SPGWU setup 92 | hosts: spgwu 93 | gather_facts: true 94 | become: yes 95 | become_method: sudo 96 | vars_files: 97 | - "../group_vars/sgx.yml" 98 | - "../group_vars/repo.yml" 99 | - "../group_vars/c3po.yml" 100 | roles: 101 | - spgwu 102 | tags: 103 | - spgwu 104 | 105 | - name: SGWU Setup 106 | hosts: sgwu 107 | become: yes 108 | become_method: sudo 109 | gather_facts: true 110 | vars_files: 111 | - "../group_vars/sgx.yml" 112 | - "../group_vars/repo.yml" 113 | - "../group_vars/c3po.yml" 114 | roles: 115 | - sgwu 116 | tags: 117 | - sgwu 118 | 119 | - name: PGWU Setup 120 | hosts: pgwu 121 | become: yes 122 | become_method: sudo 123 | gather_facts: true 124 | vars_files: 125 | - "../group_vars/repo.yml" 126 | - "../group_vars/sgx.yml" 127 | - "../group_vars/c3po.yml" 128 | roles: 129 | - pgwu 130 | tags: 131 | - pgwu 132 | -------------------------------------------------------------------------------- /ansible/playbooks/prephost.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Preparing Hosts 3 | hosts: all 4 | become: yes 5 | become_method: sudo 6 | vars_files: 7 | - "../group_vars/prephost.yml" 8 | - "../group_vars/repo.yml" 9 | # vars_prompt: 10 | # - name: "githubuser" 11 | # prompt: "Enter your github username" 12 | # private: no 13 | # - name: "githubpassword" 14 | # prompt: "Enter your github password" 15 | # private: yes 16 | roles: 17 | - kvm 18 | - ansible 19 | - terraform_setup 20 | -------------------------------------------------------------------------------- /ansible/playbooks/sgx_host_pre.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: SGX-HOST-PREPARE setup 3 | hosts: all 4 | gather_facts: true 5 | become: yes 6 | become_method: sudo 7 | vars_files: 8 | - "../group_vars/prephost.yml" 9 | roles: 10 | - sgx_host_pre 11 | tags: 12 | - sgx_host_pre 13 | -------------------------------------------------------------------------------- /ansible/readme.txt: -------------------------------------------------------------------------------- 1 | # Installation of ansible packages 2 | 3 | https://docs.ansible.com/ansible/2.6/installation_guide/intro_installation.html 4 | $ sudo apt-get update 5 | $ sudo apt-get install software-properties-common 6 | $ sudo apt-add-repository ppa:ansible/ansible 7 | $ sudo apt-get update 8 | $ sudo apt-get install ansible 9 | 10 | # Execution of playbooks 11 | 12 | /usr/bin/ansible-playbook -i inventores/inventory site.yml --private-key=/home/ubuntu/.ssh/id_rsa -u ubuntu -e githubuser="USERNAME" -e githubpassword="PASSWORD" 13 | -------------------------------------------------------------------------------- /ansible/roles/ansible/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Installing dependancies 3 | apt: 4 | name: software-properties-common 5 | update_cache: yes 6 | 7 | - name: Adding repository 8 | apt_repository: 9 | repo: ppa:ansible/ansible 10 | 11 | - name: Installing 12 | apt: 13 | name: ansible 14 | update_cache: yes 15 | -------------------------------------------------------------------------------- /ansible/roles/cdf/files/Makefile: -------------------------------------------------------------------------------- 1 | SHELL := /bin/bash 2 | all: 3 | $(MAKE) -C util 4 | $(MAKE) -C cdf 5 | 6 | clean: 7 | $(MAKE) -C util clean 8 | $(MAKE) -C cdf clean 9 | 10 | #install: 11 | # $(MAKE) -C c3poutil install 12 | -------------------------------------------------------------------------------- /ansible/roles/cdf/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create cdf directory 3 | file: 4 | path: "/opt/cdf" 5 | state: directory 6 | mode: 0755 7 | 8 | - name: Git clone for C3PO 9 | git: 10 | repo: "{{ SGX_REPO }}" 11 | dest: "{{ REPO_DIR }}" 12 | version: "{{ SGX_COMMIT_ID }}" 13 | update: no 14 | 15 | - name: Copying build script 16 | copy: 17 | src: ansible_c3po_install.sh 18 | dest: "{{ REPO_DIR }}/" 19 | owner: "root" 20 | mode: "0755" 21 | 22 | - name: Copying CDF Makefile 23 | copy: 24 | src: Makefile 25 | dest: "{{ REPO_DIR }}/" 26 | owner: "root" 27 | 28 | - name: Copying config template files 29 | template: 30 | src: cdf.conf.j2 31 | dest: "{{ REPO_DIR }}/cdf/conf/cdf.conf" 32 | owner: root 33 | 34 | - name: update dhclient entry 35 | lineinfile: 36 | path: /etc/dhcp/dhclient.conf 37 | line: 'supersede domain-name-servers {% if DNS_TYPE == "distributed" %}{{ DNS_DDNS_IP }}{% elif DNS_TYPE == "allinone" %}127.0.0.1{% endif %}' 38 | 39 | - name: update dns server IP 40 | lineinfile: 41 | path: /etc/resolv.conf 42 | insertbefore: '^nameserver' 43 | line: 'nameserver {% if DNS_TYPE == "distributed" %}{{ DNS_DDNS_IP }}{% elif DNS_TYPE == "allinone" %}127.0.0.1{% endif %}' 44 | 45 | - name: Run the installation script 46 | shell: cd {{ REPO_DIR }} && ./ansible_c3po_install.sh |tee {{ CDF_LOG }} 47 | args: 48 | executable: /bin/bash 49 | 50 | - name: Create cerificate 51 | shell: "cd {{ REPO_DIR }}/cdf/conf && ../bin/make_certs.sh {% if DNS_TYPE == 'distributed' %}cdf{% elif DNS_TYPE == 'allinone' %}{{ ansible_hostname }}{% endif %} {{ DOMAIN }}" 52 | args: 53 | executable: /bin/bash 54 | 55 | -------------------------------------------------------------------------------- /ansible/roles/cdf/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # githubuser: "" 3 | # githubpassword: "" 4 | REPO_DIR: "/opt/cdf/c3po" 5 | GIT_REPO: "https://{{ githubuser }}:{{ githubpassword }}@ilpm.intel-research.net/bitbucket/scm/vccbbw/c3po.git" 6 | CDF_LOG: "/var/log/cdf_install.log" 7 | -------------------------------------------------------------------------------- /ansible/roles/cleanup/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: cleanup deployment on target hosts 3 | shell : "cd {{ TR_REPO_DIR }} && ./destroy.sh | tee /tmp/destroy.log" 4 | args: 5 | executable: /bin/bash 6 | register: cleanup_result 7 | - debug: 8 | msg: "{{ cleanup_result.stdout }}" 9 | 10 | - name: deleting deployment directory on target hosts 11 | file: 12 | path: "{{ TR_REPO_DIR }}" 13 | state: absent 14 | register: delete_dir 15 | when: "'failed' not in cleanup_result.stdout" 16 | - debug: 17 | msg: "Deployment cleanup has been done" 18 | when: delete_dir.changed 19 | -------------------------------------------------------------------------------- /ansible/roles/common/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Update the packages on all hosts 3 | apt: 4 | update_cache: yes 5 | 6 | - name: downloading git packages 7 | apt: 8 | name: git 9 | state: present 10 | 11 | -------------------------------------------------------------------------------- /ansible/roles/ctf/files/Makefile: -------------------------------------------------------------------------------- 1 | SHELL := /bin/bash 2 | all: 3 | $(MAKE) -C util 4 | $(MAKE) -C ctf 5 | 6 | clean: 7 | $(MAKE) -C util clean 8 | $(MAKE) -C ctf clean 9 | 10 | #install: 11 | # $(MAKE) -C c3poutil install 12 | -------------------------------------------------------------------------------- /ansible/roles/ctf/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create ctf directory 3 | file: 4 | path: "/opt/ctf" 5 | state: directory 6 | mode: 0755 7 | 8 | - name: Git clone for C3PO 9 | git: 10 | repo: "{{ SGX_REPO }}" 11 | dest: "{{ REPO_DIR }}" 12 | version: "{{ SGX_COMMIT_ID }}" 13 | update: no 14 | 15 | - name: Copying build script 16 | copy: 17 | src: ansible_c3po_install.sh 18 | dest: "{{ REPO_DIR }}/" 19 | owner: "root" 20 | mode: "0755" 21 | 22 | - name: Copying CTF Makefile 23 | copy: 24 | src: Makefile 25 | dest: "{{ REPO_DIR }}/" 26 | owner: "root" 27 | mode: "0755" 28 | 29 | - name: update dns entry 30 | lineinfile: 31 | path: /etc/dhcp/dhclient.conf 32 | line: 'supersede domain-name-servers {% if DNS_TYPE == "distributed" %}{{ DNS_DDNS_IP }}{% elif DNS_TYPE == "allinone" %}127.0.0.1{% endif %}' 33 | 34 | - name: update dns server IP 35 | lineinfile: 36 | path: /etc/resolv.conf 37 | insertbefore: '^nameserver' 38 | line: 'nameserver {% if DNS_TYPE == "distributed" %}{{ DNS_DDNS_IP }}{% elif DNS_TYPE == "allinone" %}127.0.0.1{% endif %}' 39 | 40 | - name: Copying config file 41 | template: 42 | src: "{{ item.src }}" 43 | dest: "{{ item.dest }}" 44 | with_items: 45 | - {src: 'ctf.conf.j2', dest: '{{ REPO_DIR }}/ctf/conf/ctf.conf' } 46 | - {src: 'ctf.json.j2', dest: '{{ REPO_DIR }}/ctf/conf/ctf.json' } 47 | 48 | - name: Create archive and log diretcories 49 | file: 50 | path: "{{ item }}" 51 | state: directory 52 | mode: 0755 53 | with_items: 54 | - "{{ REPO_DIR }}/ctf/{{ CTF_ARCHIEVE_PATH }}" 55 | - "{{ REPO_DIR }}/ctf/{{ CTF_TRACK_PATH }}" 56 | - "{{ REPO_DIR }}/ctf/{{ CTF_LOG_PATH }}" 57 | 58 | - name: Run the installation script 59 | shell: cd {{ REPO_DIR }} && ./ansible_c3po_install.sh |tee {{ CDF_LOG }} 60 | args: 61 | executable: /bin/bash 62 | 63 | - name: Create cerificate 64 | shell: "cd {{ REPO_DIR }}/ctf/conf && ../bin/make_certs.sh ctf {{ DOMAIN }}" 65 | args: 66 | executable: /bin/bash 67 | 68 | -------------------------------------------------------------------------------- /ansible/roles/ctf/templates/ctf.json.j2: -------------------------------------------------------------------------------- 1 | {"common": { 2 | "fdcfg": "conf/ctf.conf", 3 | "originhost": "ctf.{{ DOMAIN }}", 4 | "originrealm": "{{ DOMAIN }}" 5 | }, 6 | "ctf": { 7 | "datapfx": "cdr", 8 | "datapath": "test/data", 9 | "archivepath": "test/data/archive", 10 | "trackpath": "test/data/tracking", 11 | "trackext": ".trk", 12 | "curext": ".cur", 13 | "skiprows": 1, 14 | "idledur": 1000, 15 | "maxacrs": 10, 16 | "savefreq": 10, 17 | "sdnmemcsvr": "10.31.14.83", 18 | "sdnmemcport": 11211, 19 | "logsize": 20, 20 | "lognumber": 5, 21 | "logname": "logs/ctf.log", 22 | "logqsize": 8192, 23 | "statlogsize": 20, 24 | "statlognumber": 5, 25 | "statlogname": "logs/ctf_stat.log", 26 | "auditlogsize": 20, 27 | "auditlognumber": 5, 28 | "auditlogname": "logs/ctf_audit.log", 29 | "statfreq": 2000, 30 | "ossport" : 9082, 31 | "certfile": "./certs/cert.pem", 32 | "isvsvn": {{ ISVSVN }}, 33 | {% if SGX_BUILD == "true" %} 34 | "mrenclave": "{{ hostvars[groups['sgx-dealer-out'][0]]['DLOUT_MRENCLAVE'] }}", 35 | "mrsigner": "{{ hostvars[groups['sgx-dealer-out'][0]]['DLOUT_MRSIGNER'] }}", 36 | {% else %} 37 | "mrenclave": "cb4c94f52fb1c2d840a4df31b1e0e75a1cf7327caae2e7dd106c0c3c12e6a77d", 38 | "mrsigner": "63ef969cbc34ee465f277cd3c27e9b3c681d743e455f899daced1b3cf85ceb8f", 39 | {% endif %} 40 | "privkeyfile": "./certs/key.pem", 41 | "sgxserverip": "{{ SGX_DLROUT_SGX_DLROUT_IP }}", 42 | "sgxserverport": {{ DL_OUT_PORT }}, 43 | "streamname": "0s1", 44 | "ossfile": "conf/oss.json" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /ansible/roles/ctf/templates/test.j2: -------------------------------------------------------------------------------- 1 | This is testing file 2 | DOMAIN-NAME: {{ DOMAIN }} 3 | HOST-NAME: {{ HOST }} 4 | IP: {{ SPGWU_SGI_IP }} 5 | -------------------------------------------------------------------------------- /ansible/roles/ctf/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # githubuser: "" 3 | # githubpassword: "" 4 | REPO_DIR: "/opt/ctf/c3po" 5 | GIT_REPO: "https://{{ githubuser }}:{{ githubpassword }}@ilpm.intel-research.net/bitbucket/scm/vccbbw/c3po.git" 6 | CDF_LOG: "/var/log/ctf_install.log" 7 | -------------------------------------------------------------------------------- /ansible/roles/db/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: stop cassandra 3 | service: 4 | name: cassandra 5 | state: stopped 6 | 7 | - name: start cassandra 8 | service: 9 | name: cassandra 10 | state: started 11 | -------------------------------------------------------------------------------- /ansible/roles/db/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Git clone for C3PO 3 | git: 4 | repo: "{{ C3PO_REPO }}" 5 | dest: "{{ C3PO_REPO_DIR }}" 6 | version: "{{ C3PO_COMMIT_ID }}" 7 | update: no 8 | 9 | - name: Add repo for java 10 | apt_repository: 11 | # repo: ppa:webupd8team/java 12 | repo: ppa:openjdk-r/ppa 13 | state: present 14 | 15 | # - name: Accept Java 8 License 16 | # become: yes 17 | # debconf: 18 | # name: 'oracle-java8-installer' 19 | # question: 'shared/accepted-oracle-license-v1-1' 20 | # value: 'true' 21 | # vtype: 'select' 22 | 23 | # - name: installing Orcle packages 24 | # apt: 25 | # name: oracle-java8-installer 26 | # state: present 27 | - name: Install Openjdk package 28 | apt: 29 | name: openjdk-8-jdk 30 | update_cache: yes 31 | 32 | - name: Add repo for Cassandra 33 | apt_repository: 34 | repo: deb http://www.apache.org/dist/cassandra/debian 21x main 35 | state: present 36 | 37 | - name: add key for cassandra repo 38 | apt_key: 39 | url: https://www.apache.org/dist/cassandra/KEYS 40 | state: present 41 | 42 | - name: apt update 43 | apt: 44 | update_cache=yes 45 | 46 | - name: Installing cassandra packages 47 | apt: 48 | name: cassandra 49 | state: present 50 | 51 | - name: Installing python-pip packages 52 | apt: 53 | name: "{{ item }}" 54 | state: present 55 | with_items: 56 | - python3-pip 57 | - python-pip 58 | 59 | - name: pip install cassandra-driver 60 | pip: 61 | name: cassandra-driver 62 | executable: pip2 63 | 64 | - name: check db ip as localhost 65 | shell: "cat /etc/cassandra/cassandra.yaml |grep 127.0.0.1" 66 | ignore_errors: true 67 | register: check_db_ip 68 | 69 | - name: Stopping cassandra sevice 70 | service: 71 | name: cassandra 72 | state: stopped 73 | register: _svc_cassandra 74 | when: '"127.0.0.1" in check_db_ip.stdout' 75 | 76 | - name: cleanup the log files 77 | shell: "/bin/rm -rf {{ item }}" 78 | args: 79 | warn: false 80 | with_items: 81 | - /var/lib/cassandra/data/system/* 82 | - /var/lib/cassandra/commitlog/* 83 | - /var/lib/cassandra/data/system_traces/* 84 | - /var/lib/cassandra/saved_caches/* 85 | when: '"127.0.0.1" in check_db_ip.stdout' 86 | 87 | - name: copying cassandra configuration files 88 | template: 89 | src: "{{ item.src }}" 90 | dest: "{{ item.dest }}" 91 | backup: yes 92 | with_items: 93 | - { src: 'cassandra-rackdc.j2', dest: '/etc/cassandra/cassandra-rackdc.properties' } 94 | - { src: 'cassandra.j2', dest: '/etc/cassandra/cassandra.yaml' } 95 | - { src: 'data_provisioning_users.j2', dest: '{{ C3PO_REPO_DIR }}/db_docs/data_provisioning_users.py' } 96 | - name: Start cassandra service 97 | service: 98 | name: cassandra 99 | state: started 100 | 101 | # - name: check the nodetool status. 102 | # command: "/usr/bin/nodetool status" 103 | # register: result 104 | # - debug: 105 | # var: result 106 | - name: wait service cassandra start 107 | wait_for: 108 | host: "{{ DB_DB_IP }}" 109 | port: 7000 110 | delay: 45 111 | timeout: 90 112 | 113 | - name: Create the HSS Database Schema in Cassandra 114 | shell: "cd {{ C3PO_REPO_DIR }} && cqlsh --file hss/db/oai_db.cql {{ DB_DB_IP }}" 115 | args: 116 | executable: /bin/bash 117 | 118 | - name: creation of database 119 | shell: cd {{ C3PO_REPO_DIR }}/db_docs && python data_provisioning_users.py 120 | args: 121 | executable: /bin/bash 122 | 123 | -------------------------------------------------------------------------------- /ansible/roles/db/templates/cassandra-rackdc.j2: -------------------------------------------------------------------------------- 1 | dc=DC1 2 | rack=RAC1 3 | prefer_local=true 4 | -------------------------------------------------------------------------------- /ansible/roles/db/templates/cassandra.j2: -------------------------------------------------------------------------------- 1 | cluster_name: '{{ CLUSTER_NAME }}' 2 | num_tokens: 256 3 | hinted_handoff_enabled: true 4 | hinted_handoff_throttle_in_kb: 1024 5 | max_hints_delivery_threads: 2 6 | batchlog_replay_throttle_in_kb: 1024 7 | authenticator: AllowAllAuthenticator 8 | authorizer: AllowAllAuthorizer 9 | permissions_validity_in_ms: 2000 10 | partitioner: org.apache.cassandra.dht.Murmur3Partitioner 11 | data_file_directories: 12 | - /var/lib/cassandra/data 13 | commitlog_directory: /var/lib/cassandra/commitlog 14 | disk_failure_policy: stop 15 | commit_failure_policy: stop 16 | key_cache_size_in_mb: 17 | key_cache_save_period: 14400 18 | row_cache_size_in_mb: 0 19 | row_cache_save_period: 0 20 | counter_cache_size_in_mb: 21 | counter_cache_save_period: 7200 22 | saved_caches_directory: /var/lib/cassandra/saved_caches 23 | commitlog_sync: periodic 24 | commitlog_sync_period_in_ms: 10000 25 | commitlog_segment_size_in_mb: 32 26 | seed_provider: 27 | - class_name: org.apache.cassandra.locator.SimpleSeedProvider 28 | parameters: 29 | - seeds: "{{ DB_DB_IP }}" 30 | concurrent_reads: 32 31 | concurrent_writes: 32 32 | concurrent_counter_writes: 32 33 | memtable_allocation_type: heap_buffers 34 | index_summary_capacity_in_mb: 35 | index_summary_resize_interval_in_minutes: 60 36 | trickle_fsync: false 37 | trickle_fsync_interval_in_kb: 10240 38 | storage_port: 7000 39 | ssl_storage_port: 7001 40 | listen_address: {{ DB_DB_IP }} 41 | start_native_transport: true 42 | native_transport_port: 9042 43 | start_rpc: true 44 | rpc_address: {{ DB_DB_IP }} 45 | rpc_port: 9160 46 | rpc_keepalive: true 47 | rpc_server_type: sync 48 | thrift_framed_transport_size_in_mb: 15 49 | incremental_backups: false 50 | snapshot_before_compaction: false 51 | auto_snapshot: true 52 | tombstone_warn_threshold: 1000 53 | tombstone_failure_threshold: 100000 54 | column_index_size_in_kb: 64 55 | batch_size_warn_threshold_in_kb: 5 56 | unlogged_batch_across_partitions_warn_threshold: 10 57 | compaction_throughput_mb_per_sec: 16 58 | compaction_large_partition_warning_threshold_mb: 100 59 | sstable_preemptive_open_interval_in_mb: 50 60 | read_request_timeout_in_ms: 5000 61 | range_request_timeout_in_ms: 10000 62 | write_request_timeout_in_ms: 2000 63 | counter_write_request_timeout_in_ms: 5000 64 | cas_contention_timeout_in_ms: 1000 65 | truncate_request_timeout_in_ms: 60000 66 | request_timeout_in_ms: 10000 67 | cross_node_timeout: false 68 | endpoint_snitch: {{ ENDPOINT_SNITCH }} 69 | dynamic_snitch_update_interval_in_ms: 100 70 | dynamic_snitch_reset_interval_in_ms: 600000 71 | dynamic_snitch_badness_threshold: 0.1 72 | request_scheduler: org.apache.cassandra.scheduler.NoScheduler 73 | server_encryption_options: 74 | internode_encryption: none 75 | keystore: conf/.keystore 76 | keystore_password: cassandra 77 | truststore: conf/.truststore 78 | truststore_password: cassandra 79 | client_encryption_options: 80 | enabled: false 81 | optional: false 82 | keystore: conf/.keystore 83 | keystore_password: cassandra 84 | internode_compression: all 85 | inter_dc_tcp_nodelay: false 86 | -------------------------------------------------------------------------------- /ansible/roles/db/templates/data_provisioning_users.j2: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | #script requires cassandra driver for python. 4 | #Execute following command to install driver. 5 | # pip install cassandra-driver 6 | 7 | import logging 8 | 9 | log = logging.getLogger('test') 10 | log.setLevel('ERROR') 11 | handler = logging.StreamHandler() 12 | handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(name)s: %(message)s")) 13 | log.addHandler(handler) 14 | 15 | from cassandra import ConsistencyLevel 16 | from cassandra.cluster import Cluster 17 | from cassandra.query import SimpleStatement 18 | 19 | KEYSPACE = "vhss" 20 | imsi = 208014567891234 21 | msisdn = 1122334455 22 | apn = 'apn1' 23 | key = '465B5CE8B199B49FAA5F0A2EE238A6BC' 24 | no_of_users = {{ NO_OF_USERS }} 25 | cassandra_ip = '{{ DB_DB_IP }}' 26 | 27 | 28 | def main(): 29 | global imsi 30 | global msisdn 31 | cluster = Cluster([cassandra_ip]) 32 | session = cluster.connect() 33 | 34 | for i in range(no_of_users): 35 | query = "INSERT INTO vhss.users_imsi (imsi, msisdn, access_restriction, key, mmehost, mmeidentity_idmmeidentity, mmerealm, rand, sqn, subscription_data) VALUES ('" + str(imsi) + "'," + str(msisdn) + ", 41, '" + key + "', 'mme.localdomain', 3, 'localdomain', '2683b376d1056746de3b254012908e0e', 96, '{\"Subscription-Data\":{\"Access-Restriction-Data\":41,\"Subscriber-Status\":0,\"Network-Access-Mode\":2,\"Regional-Subscription-Zone-Code\":[\"0123\",\"4567\",\"89AB\",\"CDEF\",\"1234\",\"5678\",\"9ABC\",\"DEF0\",\"2345\",\"6789\"],\"MSISDN\":\"" + str(msisdn) + "\",\"AMBR\":{\"Max-Requested-Bandwidth-UL\":50000000,\"Max-Requested-Bandwidth-DL\":100000000},\"APN-Configuration-Profile\":{\"Context-Identifier\":0,\"All-APN-Configurations-Included-Indicator\":0,\"APN-Configuration\":{\"Context-Identifier\":0,\"PDN-Type\":0,\"Served-Party-IP-Address\":[\"10.0.0.1\",\"10.0.0.2\"],\"Service-Selection\":\"apn1\",\"EPS-Subscribed-QoS-Profile\":{\"QoS-Class-Identifier\":9,\"Allocation-Retention-Priority\":{\"Priority-Level\":15,\"Pre-emption-Capability\":0,\"Pre-emption-Vulnerability\":0}},\"AMBR\":{\"Max-Requested-Bandwidth-UL\":50000000,\"Max-Requested-Bandwidth-DL\":100000000},\"PDN-GW-Allocation-Type\":0,\"MIP6-Agent-Info\":{\"MIP-Home-Agent-Address\":[\"172.26.17.183\"]}}},\"Subscribed-Periodic-RAU-TAU-Timer\":0}}');" 36 | session.execute(query) 37 | 38 | query1 = "INSERT INTO vhss.msisdn_imsi (msisdn, imsi) VALUES (" + str(msisdn) + ", '" + str(imsi) + "');" 39 | session.execute(query1) 40 | imsi += 1 41 | msisdn += 1 42 | 43 | 44 | if __name__ == "__main__": 45 | main() 46 | 47 | 48 | -------------------------------------------------------------------------------- /ansible/roles/db/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ENDPOINT_SNITCH: GossipingPropertyFileSnitch 3 | CLUSTER_NAME: "HSS CLUSTER" 4 | NO_OF_USERS: "1000" 5 | -------------------------------------------------------------------------------- /ansible/roles/dns/files/default_bind: -------------------------------------------------------------------------------- 1 | # run resolvconf? 2 | RESOLVCONF=no 3 | 4 | # startup options for the server 5 | OPTIONS="-4 -u bind" 6 | 7 | -------------------------------------------------------------------------------- /ansible/roles/dns/files/named.conf.options: -------------------------------------------------------------------------------- 1 | options { 2 | directory "/var/cache/bind"; 3 | 4 | // If there is a firewall between you and nameservers you want 5 | // to talk to, you may need to fix the firewall to allow multiple 6 | // ports to talk. See http://www.kb.cert.org/vuls/id/800113 7 | 8 | // If your ISP provided one or more IP addresses for stable 9 | // nameservers, you probably want to use them as forwarders. 10 | // Uncomment the following block, and insert the addresses replacing 11 | // the all-0's placeholder. 12 | 13 | forwarders { 14 | 8.8.8.8; 15 | }; 16 | 17 | //======================================================================== 18 | // If BIND logs error messages about the root key being expired, 19 | // you will need to update your keys. See https://www.isc.org/bind-keys 20 | //======================================================================== 21 | dnssec-validation auto; 22 | 23 | auth-nxdomain no; # conform to RFC1035 24 | listen-on-v6 { any; }; 25 | }; 26 | -------------------------------------------------------------------------------- /ansible/roles/dns/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # handlers file for Bind setup 3 | - name: restart bind9 4 | service: 5 | name: bind9 6 | state: restarted 7 | -------------------------------------------------------------------------------- /ansible/roles/dns/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Task file Bind setup 3 | - name: Install bind packages 4 | apt: 5 | name: "{{ item }}" 6 | state: present 7 | with_items: 8 | - bind9 9 | - dnsutils 10 | - bind9-doc 11 | 12 | - name: Set hostname 13 | # hostname: 14 | # name: "{% if DNS_TYPE == 'distributed' %} 15 | # {{ HOST_NAME }} 16 | # {% elif DNS_TYPE == 'allinone' %} 17 | # {{ ALLINONE_HOST }} 18 | # {% endif %}" 19 | shell: hostnamectl set-hostname "{% if DNS_TYPE == 'distributed' %}{{ HOST_NAME }}{% elif DNS_TYPE == 'allinone' %} {{ ALLINONE_HOST }} {% endif %}" 20 | 21 | # - name: Set hostname fact 22 | # set_fact: 23 | # ansible_fqdn: "{% if DNS_TYPE == 'distributed' %}{{ HOST_NAME }}{% endif %}" 24 | 25 | - name: copying default bind and named options files 26 | copy: 27 | src: "{{ item.src }}" 28 | dest: "{{ item.dest }}" 29 | owner: "root" 30 | mode: "0644" 31 | notify: restart bind9 32 | with_items: 33 | - { src: 'named.conf.options', dest: '/etc/bind/named.conf.options' } 34 | - { src: 'default_bind', dest: '/etc/default/bind9' } 35 | 36 | - name: copying forward and reverse zone configuration files 37 | template: 38 | src: "{{ item.src }}" 39 | dest: "{{ item.dest }}" 40 | notify: restart bind9 41 | with_items: 42 | - { src: 'db_forwarder.j2', dest: '/etc/bind/db.{{ DOMAIN }}' } 43 | - { src: 'db_reverse.j2', dest: '/etc/bind/db.{{ DNS_DDNS_IP.split(".")[-1] }}' } 44 | - { src: 'named.conf.local.j2', dest: '/etc/bind/named.conf.local' } 45 | 46 | - name: search host entry for {{ DOMAIN }} 47 | shell: "cat /etc/hosts |grep 127.0.1.1" 48 | ignore_errors: true 49 | register: check_host 50 | 51 | - name: update hosts file 52 | shell: "{{ item }}" 53 | with_items: 54 | - "echo \"127.0.1.1\t{{ HOST_NAME }}.{{ DOMAIN }}\t{{ HOST_NAME }}\" >> /etc/hosts" 55 | - "echo \"{{ DNS_DDNS_IP }}\t{{ HOST_NAME }}.{{ DOMAIN }}\t{{ HOST_NAME }}\" >> /etc/hosts" 56 | when: '"127.0.1.1" not in check_host.stdout' 57 | -------------------------------------------------------------------------------- /ansible/roles/dns/templates/db_forwarder.j2: -------------------------------------------------------------------------------- 1 | {% if DNS_TYPE == "distributed" %} 2 | ; 3 | ; BIND data file for local loopback interface 4 | ; 5 | $TTL 604800 6 | @ IN SOA {{ HOST_NAME }}.{{ DOMAIN }}. root.{{ HOST_NAME }}.{{ DOMAIN }}. ( 7 | 2 ; Serial 8 | 604800 ; Refresh 9 | 86400 ; Retry 10 | 2419200 ; Expire 11 | 604800 ) ; Negative Cache TTL 12 | ; 13 | @ IN NS {{ HOST_NAME }}.{{ DOMAIN }}. 14 | @ IN A 127.0.0.1 15 | @ IN AAAA ::1 16 | 17 | {{ HOST_NAME }} IN A {{ DNS_DDNS_IP }} 18 | ctf IN A {{ CTF_CTF_RF_IP }} 19 | cdf IN A {{ CDF_CDF_RF_IP }} 20 | 21 | _diameter._tcp SRV 5 100 30868 cdf 22 | 23 | diameter ( 24 | IN NAPTR 10 100 "S" "aaa+ap3:diameter.tcp" "" _diameter._tcp ) 25 | {% elif DNS_TYPE == "allinone" %} 26 | ; 27 | ; BIND data file for local loopback interface 28 | ; 29 | $TTL 604800 30 | @ IN SOA {{ ansible_hostname }}.{{ DOMAIN }}. root.{{ ansible_hostname }}.{{ DOMAIN }}. ( 31 | 2 ; Serial 32 | 604800 ; Refresh 33 | 86400 ; Retry 34 | 2419200 ; Expire 35 | 604800 ) ; Negative Cache TTL 36 | ; 37 | @ IN NS {{ ansible_hostname }}.{{ DOMAIN }}. 38 | @ IN A 127.0.0.1 39 | @ IN AAAA ::1 40 | 41 | {{ ansible_hostname }} IN A {{ DNS_DDNS_IP }} 42 | 43 | _diameter._tcp SRV 5 100 30868 {{ ansible_hostname }} 44 | 45 | diameter ( 46 | IN NAPTR 10 100 "S" "aaa+ap3:diameter.tcp" "" _diameter._tcp ) 47 | {% endif %} 48 | -------------------------------------------------------------------------------- /ansible/roles/dns/templates/db_reverse.j2: -------------------------------------------------------------------------------- 1 | {% if DNS_TYPE == "distributed" %} 2 | ; 3 | ; BIND reverse data file for local loopback interface 4 | ; 5 | $TTL 604800 6 | @ IN SOA {{ HOST_NAME }}.{{ DOMAIN }}. root.{{ HOST_NAME }}.{{ DOMAIN }}. ( 7 | 1 ; Serial 8 | 604800 ; Refresh 9 | 86400 ; Retry 10 | 2419200 ; Expire 11 | 604800 ) ; Negative Cache TTL 12 | ; 13 | @ IN NS {{ HOST_NAME }}.{{ DOMAIN }}. 14 | {{ CTF_CTF_RF_IP.split(".")[-1] }} IN PTR ctf.{{ DOMAIN }}. 15 | {{ CDF_CDF_RF_IP.split(".")[-1] }} IN PTR cdf.{{ DOMAIN }}. 16 | {% elif DNS_TYPE == "allinone" %} 17 | ; 18 | ; BIND reverse data file for local loopback interface 19 | ; 20 | $TTL 604800 21 | @ IN SOA {{ ansible_hostname }}.{{ DOMAIN }}. root.{{ ansible_hostname }}.{{ DOMAIN }}. ( 22 | 1 ; Serial 23 | 604800 ; Refresh 24 | 86400 ; Retry 25 | 2419200 ; Expire 26 | 604800 ) ; Negative Cache TTL 27 | ; 28 | @ IN NS {{ ansible_hostname }}.{{ DOMAIN }}. 29 | {% endif %} 30 | -------------------------------------------------------------------------------- /ansible/roles/dns/templates/named.conf.local.j2: -------------------------------------------------------------------------------- 1 | // 2 | // Do any local configuration here 3 | // 4 | 5 | // Consider adding the 1918 zones here, if they are not used in your 6 | // organization 7 | //include "/etc/bind/zones.rfc1918"; 8 | 9 | zone "{{ DOMAIN }}" { 10 | type master; 11 | file "/etc/bind/db.{{ DOMAIN }}"; 12 | }; 13 | 14 | zone "{{ '.'.join(DNS_DDNS_IP.split('.')[-2::-1]) }}in-addr.arpa" { 15 | type master; 16 | notify no; 17 | file "/etc/bind/db.{{ DNS_DDNS_IP.split(".")[-1] }}"; 18 | }; 19 | 20 | -------------------------------------------------------------------------------- /ansible/roles/dns/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Variables for Bind setup 3 | # DNS_TYPE: allinone/distributed" 4 | ALLINONE_HOST: "{{ ansible_hostname }}" 5 | -------------------------------------------------------------------------------- /ansible/roles/fpc/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Git clone for FPC 3 | git: 4 | repo: "{{ ODL_REPO }}" 5 | dest: "{{ ODL_REPO_DIR }}" 6 | key_file: "/home/c3po_ngic.key" 7 | accept_hostkey: yes 8 | version: "{{ ODL_COMMIT_ID }}" 9 | update: no 10 | 11 | - name: copying build script 12 | copy: 13 | src: fpc_install_wo_menu.sh 14 | dest: "{{ ODL_REPO_DIR }}/" 15 | owner: "root" 16 | mode: "0755" 17 | - name: Installing lib and JDK packages 18 | apt: 19 | name: "{{ item }}" 20 | state: present 21 | with_items: 22 | - curl 23 | - build-essential 24 | - unzip 25 | - libpcap0.8-dev 26 | - gcc 27 | - libjson0-dev 28 | - make 29 | - libc6 30 | - libc6-dev 31 | - g++-multilib 32 | - libzmq3-dev 33 | - libcurl4-openssl-dev 34 | - openjdk-8-jdk 35 | - python-pip 36 | - linux-headers-{{ ansible_kernel }} 37 | - name: installing pyzmq package 38 | pip: 39 | name: "{{ item }}" 40 | executable: pip2 41 | with_items: 42 | - pyzmq 43 | - netaddr 44 | - configparser 45 | - name: Run the installation script 46 | shell: cd {{ ODL_REPO_DIR }} && ./fpc_install_wo_menu.sh |tee {{ FPC_LOG }} 47 | args: 48 | executable: /bin/bash 49 | 50 | - name: copying start FPC script 51 | template: 52 | src: new_run.j2 53 | dest: "{{ ODL_REPO_DIR }}/new_run.sh" 54 | owner: root 55 | mode: 0755 56 | 57 | # - name: starting FPC service 58 | # shell: cd {{ ODL_REPO_DIR }} && ./new_run.sh & 59 | # args: 60 | # executable: /bin/bash 61 | 62 | 63 | -------------------------------------------------------------------------------- /ansible/roles/fpc/templates/new_run.j2: -------------------------------------------------------------------------------- 1 | # VISHAL : Work in-progress 2 | #set -x 3 | export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::") 4 | FPC_DIR={{ ODL_REPO_DIR }} 5 | #FPC_DIR=/home/fpc 6 | 7 | #while $FPC_DIR/karaf/target/assembly/bin/karaf status; do 8 | pgrep -fa java &> /dev/null 9 | if [ $? -eq 0 ]; then 10 | echo "FPC found running... exiting" 11 | ./cleanup.sh &> /dev/null 12 | # $FPC_DIR/karaf/target/assembly/bin/karaf stop 13 | pkill -9 java 14 | sleep 10 15 | fi 16 | echo "FPC not found running" 17 | 18 | echo "Starting FPC" 19 | #\taskset -pc 2-7 $$ 20 | $FPC_DIR/karaf/target/assembly/bin/start 21 | # $FPC_DIR/karaf/target/assembly/bin/start & 22 | #echo "Checking FPC" 23 | #until $FPC_DIR/karaf/target/assembly/bin/karaf status &> /dev/null; do : ; done 24 | sleep 10 25 | pgrep -fa java &> /dev/null 26 | if [ $? -nq 0 ]; then 27 | sleep 10 28 | fi 29 | echo "ODL-Karaf Running" 30 | #\cd /home/fpc_ctrl 31 | #until ./get-topology.sh ; do sleep 1; : ; done 32 | #\until ./topology.sh ; do sleep 1; : ; done 33 | #\echo "FPC Responding - Purging remaining DPNs" 34 | #\./cleanup.sh &> /dev/null 35 | pgrep -fa python | grep forwarder_device.py &> /dev/null 36 | if [ $? -eq 0 ]; then 37 | echo "forwarder_device already running" 38 | else 39 | echo "Starting forwarder_device" 40 | $FPC_DIR/zmqforwarder/forwarder_device.py & 41 | fi 42 | #if [ $? -eq 1 ]; then 43 | # echo "Starting forwarder_device" 44 | # taskset -pc 1 $$ 45 | # $FPC_DIR/zmqforwarder/forwarder_device.py & 46 | 47 | #else 48 | # echo "forwarder_device.py already Running" 49 | #fi 50 | 51 | pgrep -fa python | grep rules_pub.py &> /dev/null 52 | if [ $? -eq 1 ]; then 53 | echo "Starting rules_pub.py" 54 | pushd $FPC_DIR/zmqforwarder/test_rules/ 55 | #/home/gslab/amit/fpc/zmqforwarder/test_rules/rules_pub.py & 56 | python rules_pub.py 57 | popd 58 | echo "process complete" 59 | else 60 | echo "rules_pub.py already Running" 61 | fi 62 | 63 | -------------------------------------------------------------------------------- /ansible/roles/fpc/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | FPC_LOG: "/var/log/fpc_install.log" 3 | -------------------------------------------------------------------------------- /ansible/roles/hss/files/Makefile: -------------------------------------------------------------------------------- 1 | SHELL := /bin/bash 2 | all: 3 | $(MAKE) -C util 4 | $(MAKE) -C hsssec 5 | $(MAKE) -C hss 6 | $(MAKE) -C hssgtw 7 | 8 | clean: 9 | $(MAKE) -C util clean 10 | $(MAKE) -C hsssec clean 11 | $(MAKE) -C hss clean 12 | $(MAKE) -C hssgtw clean 13 | 14 | #install: 15 | # $(MAKE) -C c3poutil install 16 | -------------------------------------------------------------------------------- /ansible/roles/hss/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Git clone for C3PO 3 | git: 4 | repo: "{{ C3PO_REPO }}" 5 | dest: "{{ C3PO_REPO_DIR }}" 6 | version: "{{ C3PO_COMMIT_ID }}" 7 | update: no 8 | 9 | - name: copying build script 10 | copy: 11 | src: "{{ item }}" 12 | dest: "{{ C3PO_REPO_DIR }}/" 13 | owner: "root" 14 | mode: "0755" 15 | with_items: 16 | - ansible_c3po_install.sh 17 | - Makefile 18 | 19 | - name: Run the installation script 20 | shell: cd {{ C3PO_REPO_DIR }} && ./ansible_c3po_install.sh |tee {{ HSS_LOG }} 21 | args: 22 | executable: /bin/bash 23 | 24 | - name: copying hss configuration files 25 | template: 26 | src: "{{ item.src }}" 27 | dest: "{{ item.dest }}" 28 | backup: yes 29 | with_items: 30 | - { src: 'hss-conf.j2', dest: '/opt/c3po/hss/conf/hss.conf' } 31 | - { src: 'hss-json.j2', dest: '/opt/c3po/hss/conf/hss.json' } 32 | 33 | - name: create cerificate 34 | shell: "cd {{ C3PO_REPO_DIR }}/hss/conf && ../bin/make_certs.sh hss {{ ORIGIN }}" 35 | args: 36 | executable: /bin/bash 37 | -------------------------------------------------------------------------------- /ansible/roles/hss/templates/hss-json.j2: -------------------------------------------------------------------------------- 1 | {"common": { 2 | "fdcfg": "conf/hss.conf", 3 | "originhost": "hss.{{ ORIGIN }}", 4 | "originrealm": "{{ ORIGIN }}" 5 | }, 6 | "hss": { 7 | "gtwhost": "*", 8 | "gtwport" : 9080, 9 | "restport" : 9081, 10 | "ossport" : 9082, 11 | "casssrv": "{{ DB_DB_IP }}", 12 | "cassusr": "{{ CASS_USR }}", 13 | "casspwd": "{{ CASS_PWD }}", 14 | "cassdb" : "{{ CASS_DB }}", 15 | "casscoreconnections" : 2, 16 | "cassmaxconnections" : 8, 17 | "cassioqueuesize" : 32768, 18 | "cassiothreads" : 2, 19 | "randv" : true, 20 | "optkey" : "{{ HSS_OPTKEY }}", 21 | "reloadkey" : false, 22 | "logsize": 20, 23 | "lognumber": 5, 24 | "logname": "logs/hss.log", 25 | "logqsize": 8192, 26 | "statlogsize": 20, 27 | "statlognumber": 5, 28 | "statlogname": "logs/hss_stat.log", 29 | "auditlogsize": 20, 30 | "auditlognumber": 5, 31 | "auditlogname": "logs/hss_audit.log", 32 | "statfreq": 2000, 33 | "numworkers": 4, 34 | "concurrent": 10, 35 | "ossfile": "conf/oss.json" 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /ansible/roles/hss/vars/main.yml: -------------------------------------------------------------------------------- 1 | HSS_LOG: "/var/log/hss_install.log" 2 | -------------------------------------------------------------------------------- /ansible/roles/kvm/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Installing KVM packages 3 | apt: 4 | name: 5 | - qemu-kvm 6 | - libvirt-bin 7 | - virtinst 8 | - bridge-utils 9 | - cpu-checker 10 | - virt-manager 11 | - lshw 12 | - mkisofs 13 | state: present 14 | 15 | - name: add ubuntu user to libvirt group 16 | user: 17 | name: root 18 | groups: libvirtd 19 | append: yes 20 | 21 | - name: Check Virtualization (VT-D) enabled 22 | shell: "{{ item }}" 23 | with_items: 24 | - 'lsmod |grep kvm |grep -w vfio_pci' 25 | - 'virt-host-validate |grep -i virtualization | grep PASS' 26 | ignore_errors: yes 27 | register: vfio 28 | 29 | - name: Load vfio module 30 | shell: modprobe vfio_pci 31 | when: vfio.results[0].rc == 1 32 | 33 | # - name: Enable device passthrough for KVM update grup entries 34 | # shell: sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"intel_iommu=on\"/g" /etc/default/grub 35 | -------------------------------------------------------------------------------- /ansible/roles/mme/files/Makefile: -------------------------------------------------------------------------------- 1 | SHELL := /bin/bash 2 | all: 3 | $(MAKE) -C util 4 | $(MAKE) -C mme/sec MACHINE=BIT64 5 | pushd mme; ./build; popd 6 | 7 | clean: 8 | $(MAKE) -C util clean 9 | $(MAKE) -C mme/sec clean 10 | pushd mme; ./clean; popd 11 | 12 | #install: 13 | # $(MAKE) -C c3poutil install 14 | -------------------------------------------------------------------------------- /ansible/roles/mme/files/interfaces-mme: -------------------------------------------------------------------------------- 1 | # This file describes the network interfaces available on your system 2 | # and how to activate them. For more information, see interfaces(5). 3 | source /etc/network/interfaces.d/* 4 | # The loopback network interface 5 | auto lo 6 | iface lo inet loopback 7 | # The primary network interface 8 | auto ens3 9 | iface ens3 inet dhcp 10 | 11 | # The S1MME communication interface 12 | auto ens9 13 | iface ens9 inet static 14 | address 10.0.10.20 15 | netmask 255.255.255.0 16 | network 10.0.10.0 17 | 18 | # The S6A communication interface 19 | auto ens4 20 | iface ens4 inet static 21 | address 192.168.110.53 22 | netmask 255.255.255.0 23 | network 192.168.110.0 24 | 25 | # The S11 communication interface 26 | auto ens5 27 | iface ens5 inet static 28 | address 10.1.10.22 29 | netmask 255.255.255.0 30 | network 10.1.10.0 31 | 32 | -------------------------------------------------------------------------------- /ansible/roles/mme/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - setup: 3 | register: host_facts 4 | - set_fact: 5 | temp_var: "{{ ansible_interfaces|sort }}" 6 | - set_fact: 7 | S1MME_DEV: "ansible_{{ temp_var[3] }}" 8 | 9 | - name: Installing Packages 10 | apt: 11 | name: "{{ packages }}" 12 | vars: 13 | packages: 14 | - git 15 | - build-essential 16 | - cmake 17 | - libuv-dev 18 | - libgcrypt-dev 19 | - libidn11-dev 20 | - bison 21 | - libsctp-dev 22 | - flex 23 | - libgnutls-dev 24 | - libssl-dev 25 | 26 | - name: Git clone for C3PO 27 | git: 28 | repo: "{{ MME_REPO }}" 29 | dest: "{{ MME_REPO_DIR }}" 30 | version: "{{ MME_COMMIT_ID }}" 31 | update: no 32 | 33 | - name: Create modules directory 34 | file: 35 | path: "{{ MME_REPO_DIR }}/modules" 36 | state: directory 37 | 38 | - name: git clone FreeDiameter repo 39 | git: 40 | repo: "{{ FREEDIAMETER_REPO }}" 41 | dest: "{{ FREEDIAMETER_DIR }}" 42 | update: no 43 | 44 | - name: Create FreeDiameter build directory 45 | file: 46 | path: "{{ FREEDIAMETER_DIR }}/build" 47 | state: directory 48 | 49 | - name: Build FreeDiameter 50 | shell: "cmake -DDISABLE_SCTP:BOOL=ON .. && make -j && make install |tee /var/log/freediameter.log" 51 | args: 52 | chdir: "{{ FREEDIAMETER_DIR }}/build" 53 | executable: /bin/bash 54 | 55 | - name: Build Openmme 56 | shell: make clean && make && make install |tee {{ MME_LOG }} 57 | args: 58 | chdir: "{{ MME_REPO_DIR }}" 59 | executable: /bin/bash 60 | 61 | - name: update S1MME device name 62 | replace: 63 | path: "/etc/network/interfaces" 64 | regexp: 'ens6' 65 | replace: "{{ host_facts.ansible_facts[S1MME_DEV].device }}" 66 | register: s1mme_int_id 67 | 68 | - name: up S1MME interface 69 | shell: "sudo ifup {{ host_facts.ansible_facts[S1MME_DEV].device }}" 70 | args: 71 | executable: /bin/bash 72 | when: s1mme_int_id.changed 73 | -------------------------------------------------------------------------------- /ansible/roles/mme/templates/vbfd-conf.j2: -------------------------------------------------------------------------------- 1 | # -------- Test configuration --------- 2 | 3 | # Identity = "."; 4 | Identity = "mme.localdomain"; 5 | Realm = "localdomain"; 6 | # Port = 3868; 7 | # SecPort = 3869; 8 | 9 | ConnectPeer = "hss.{{ ORIGIN }}" { ConnectTo = "{{ HSS_S6A_IP }}"; No_TLS; port = 3868; }; 10 | 11 | # TLS_Cred = ".cert.pem", ".key.pem"; 12 | TLS_Cred = "mme.cert.pem", 13 | "mme.key.pem"; 14 | TLS_CA = "cacert.pem"; 15 | 16 | LoadExtension = "/usr/local/lib/freeDiameter/dict_3gpp2_avps.fdx"; 17 | #LoadExtension = "/usr/local/lib/freeDiameter/dict_CreditControl.fdx"; 18 | #LoadExtension = "/usr/local/lib/freeDiameter/dict_base_rfc6733.fdx"; 19 | LoadExtension = "/usr/local/lib/freeDiameter/dict_draftload_avps.fdx"; 20 | LoadExtension = "/usr/local/lib/freeDiameter/dict_etsi283034_avps.fdx"; 21 | LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc4004_avps.fdx"; 22 | LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc4006bis_avps.fdx"; 23 | LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc4072_avps.fdx"; 24 | LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc4590_avps.fdx"; 25 | LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc5447_avps.fdx"; 26 | LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc5580_avps.fdx"; 27 | LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc5777_avps.fdx"; 28 | LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc5778_avps.fdx"; 29 | LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc6734_avps.fdx"; 30 | LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc6942_avps.fdx"; 31 | LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc7155_avps.fdx"; 32 | LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc7683_avps.fdx"; 33 | LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc7944_avps.fdx"; 34 | LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29061_avps.fdx"; 35 | LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29128_avps.fdx"; 36 | LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29154_avps.fdx"; 37 | LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29173_avps.fdx"; 38 | LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29212_avps.fdx"; 39 | LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29214_avps.fdx"; 40 | LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29215_avps.fdx"; 41 | LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29217_avps.fdx"; 42 | LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29229_avps.fdx"; 43 | LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29272_avps.fdx"; 44 | LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29273_avps.fdx"; 45 | LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29329_avps.fdx"; 46 | LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29336_avps.fdx"; 47 | LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29337_avps.fdx"; 48 | LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29338_avps.fdx"; 49 | LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29343_avps.fdx"; 50 | LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29344_avps.fdx"; 51 | LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29345_avps.fdx"; 52 | LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29368_avps.fdx"; 53 | LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29468_avps.fdx"; 54 | LoadExtension = "/usr/local/lib/freeDiameter/dict_ts32299_avps.fdx"; 55 | #LoadExtension = "/usr/local/lib/freeDiameter/dict_CxDx.fdx"; 56 | #LoadExtension = "/usr/local/lib/freeDiameter/dict_Gx.fdx"; 57 | #LoadExtension = "/usr/local/lib/freeDiameter/dict_NAS.fdx"; 58 | #LoadExtension = "/usr/local/lib/freeDiameter/dict_Rf.fdx"; 59 | #LoadExtension = "/usr/local/lib/freeDiameter/dict_Ro.fdx"; 60 | #LoadExtension = "/usr/local/lib/freeDiameter/dict_Rx.fdx"; 61 | LoadExtension = "/usr/local/lib/freeDiameter/dict_S6as6d.fdx"; 62 | LoadExtension = "/usr/local/lib/freeDiameter/dict_S6c.fdx"; 63 | #LoadExtension = "/usr/local/lib/freeDiameter/dict_S6mS6n.fdx"; 64 | LoadExtension = "/usr/local/lib/freeDiameter/dict_S6t.fdx"; 65 | #LoadExtension = "/usr/local/lib/freeDiameter/dict_S9.fdx"; 66 | LoadExtension = "/usr/local/lib/freeDiameter/dict_SGd.fdx"; 67 | #LoadExtension = "/usr/local/lib/freeDiameter/dict_SLh.fdx"; 68 | #LoadExtension = "/usr/local/lib/freeDiameter/dict_Sd.fdx"; 69 | #LoadExtension = "/usr/local/lib/freeDiameter/dict_Sh.fdx"; 70 | #LoadExtension = "/usr/local/lib/freeDiameter/dict_T4.fdx"; 71 | LoadExtension = "/usr/local/lib/freeDiameter/dict_T6aT6bT7.fdx"; 72 | #LoadExtension = "/usr/local/lib/freeDiameter/dict_Tsp.fdx"; 73 | 74 | -------------------------------------------------------------------------------- /ansible/roles/mme/templates/vbsm_cfg-txt.j2: -------------------------------------------------------------------------------- 1 | # Configuration file for MME 2 | 3 | ##### NOTE: Please Do NOT change the order of the parameters ##### 4 | 5 | # EGTP related 6 | VBSM_EG_DFLT_PORT 2123 # EGTP Default port 7 | VBSM_EG_NONDFLT_PORT 2124 # EGTP Non Default port 8 | VBSM_EG_S10_NONDFLT_PORT 2125 # EGTP Non Default 9 | VBSM_EG_S3_NONDFLT_PORT 2126 # EGTP Non Default port for S3 interface towards SGSN 10 | # port for S10 11 | VBSM_EG_DFLT_HOST_NAME "sutlej.ccin.ccpu.com" # EGTP host name 12 | 13 | 14 | # E-NodeB related 15 | VBSM_ENB_ADDR_1 "{{ VBSM_ENB_ADDR_1 }}" # IP address of eNodeB 16 | VBSM_ENB_PORT_1 32767 # eNodeB port 17 | #VBSM_ENB_ADDR_2 "172.26.20.180" # IP address of eNodeB 18 | #VBSM_ENB_PORT_2 36422 # eNodeB port 19 | 20 | # MME related 21 | VBSM_MME_IPADDR "{{ MME_S1MME_IP }}" # MME IP address 22 | VBSM_MME_S1AP_IPADDR "{{ VBSM_MME_S1AP_IPADDR }}" # MME IP address associated with the S1AP interface 23 | VBSM_MME_EGTP_IPADDR "{{ VBSM_MME_EGTP_IPADDR }}" # MME IP address associated with the EGTP interface 24 | VBSM_MME_SCTP_PORT 36412 # MME SCTP port 25 | 26 | VBSM_SGW_IPADDR "{{ SPGWC_S11_IP }}" # SGW IP address 27 | VBSM_PGW_IPADDR "{{ VBSM_PGW_IPADDR }}" # PDN-GW IP address 28 | 29 | VBSM_UE_NUM {{ VBSM_UE_NUM }} # Support 1000 UE's 30 | VBSM_SCTP_UDP_SERV_TYPE 0 #service type,default 0 SCTP 31 | 32 | # Debug mask to be set; each represent 33 | #different debug masks to be set (1 and 0 to unset) 34 | #in the form |LVB_DBGMASK_INFO|LVB_DBGMASK_ERROR|LVB_DBGMASK_TRC|LVB_DBGMASK_MEM 35 | 36 | VBSM_MME_DBG_MASK 0000 37 | VBSM_DBG_MASK 0000 38 | VBSM_NW_INIATED_DETACH_TIMER 1000 39 | 40 | VBSM_MCC_DIG1 {{ VBSM_MCC_DIG1 }} 41 | VBSM_MCC_DIG2 {{ VBSM_MCC_DIG2 }} 42 | VBSM_MCC_DIG3 {{ VBSM_MCC_DIG3 }} 43 | 44 | VBSM_MNC_DIG1 {{ VBSM_MNC_DIG1 }} 45 | VBSM_MNC_DIG2 {{ VBSM_MNC_DIG2 }} 46 | VBSM_MNC_DIG3 {{ VBSM_MNC_DIG3 }} 47 | 48 | # Target PLMN ID format [ MCC + MNC], + is concatination operator 49 | # If MNC has two digits, the last charater shall be 'f' 50 | # Valid Configurations: 11223f, 112345. 51 | VBSM_TARGET_MME_PLMN_ID {{ VBSM_TARGET_MME_PLMN_ID }} 52 | VBSM_TARGET_MME_IP_ADDR "{{ VBSM_TARGET_MME_IP_ADDR }}" 53 | 54 | VBSM_T3412 32 55 | 56 | VBSM_SGSN_IP_ADDR "{{ VBSM_SGSN_IP_ADDR }}" 57 | 58 | 59 | VBSM_SGSN_PLMN_ID {{ VBSM_SGSN_PLMN_ID }} 60 | 61 | VBSM_FD_CFG "vbfd.conf" 62 | VBSM_HSS_HOST "hss.{{ ORIGIN }}" 63 | VBSM_HSS_REALM "{{ ORIGIN }}" 64 | 65 | # set VBSM_DISABLE_EPC_DNS 0 - enable DNS, 1 - disable DNS 66 | VBSM_DISABLE_EPC_DNS 1 67 | VBSM_DISABLE_EIA0 1 68 | VBSM_REL_CAP 1 69 | VBSM_MME_NAME "{{ VBSM_MME_NAME }}" 70 | VBSM_S1C_SCTP_INSTREAMS 10 71 | VBSM_S1C_SCTP_OUTSTREAMS 10 72 | VBSM_MAX_ENB {{ VBSM_MAX_ENB }} 73 | VBSM_NO_OFGUMMEIS 1 74 | VBSM_MMECODE {{ VBSM_MMECODE }} 75 | VBSM_MMEGRPID {{ VBSM_MMEGRPID }} 76 | VBSM_NO_OF_TAI 1 77 | VBSM_TAI_LIST {{1,2,0,8,0,1,1}} 78 | 79 | VBSM_SMS_ROUTER_HOST "smsrouter.{{ DOMAIN }}" 80 | VBSM_SMS_ROUTER_REALM "{{ DOMAIN }}" 81 | 82 | -------------------------------------------------------------------------------- /ansible/roles/mme/vars/main.yml: -------------------------------------------------------------------------------- 1 | MME_LOG: "/var/log/mme_install.log" 2 | -------------------------------------------------------------------------------- /ansible/roles/pgwc/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Git clone for NGIC-RTC 3 | git: 4 | repo: "{{ NGIC_REPO }}" 5 | dest: "{{ NGIC_REPO_DIR }}" 6 | version: "{{ NGIC_COMMIT_ID }}" 7 | update: no 8 | 9 | - name: copying build script 10 | copy: 11 | src: build.sh 12 | dest: "{{ NGIC_REPO_DIR }}/" 13 | owner: "root" 14 | mode: "0755" 15 | 16 | - name: copying sgwc configuration files 17 | template: 18 | src: "{{ item.src }}" 19 | dest: "{{ item.dest }}" 20 | backup: yes 21 | with_items: 22 | - { src: 'cp_config.j2', dest: '/{{ NGIC_REPO_DIR }}/config/cp_config.cfg' } 23 | - { src: 'interface.j2', dest: '/{{ NGIC_REPO_DIR }}/config/interface.cfg' } 24 | # - { src: 'ng-core_cfg.j2', dest: '{{ NGIC_REPO_DIR }}/config/ng-core_cfg.mk' } 25 | # - { src: 'run_pgwc.j2', dest: '{{ SERVICE_SCRIPT_PATH }}' } 26 | # - { src: 'pgwc.service.j2', dest: '/etc/systemd/system/pgwc.service' } 27 | 28 | # - name: systemctl daemon-reload and set permission pgwc service 29 | # shell: chmod +x {{ SERVICE_SCRIPT_PATH }} && systemctl daemon-reload 30 | # args: 31 | # executable: /bin/bash 32 | 33 | - name: Run the installation script 34 | shell: cd {{ NGIC_REPO_DIR }} && ./build.sh cp |tee {{ PGWC_LOG }} 35 | args: 36 | executable: /bin/bash 37 | 38 | # - name: staring pgwc service 39 | # service: 40 | # name: pgwc 41 | # state: started 42 | -------------------------------------------------------------------------------- /ansible/roles/pgwc/templates/cp_config.j2: -------------------------------------------------------------------------------- 1 | NOW=$(date +"%Y-%m-%d_%H-%M") 2 | FILE="logs/cp_$NOW.log" 3 | #SPGW_CFG:: SGWC=01; PGWC=02; SPGWC=03 4 | SPGW_CFG=02 5 | S11_MME_IP={{ MME_S11_IP }} 6 | S11_SGW_IP={{ SGWC_S11_IP }} 7 | S1U_SGW_IP={{ SGWU_S1U_IP }} 8 | S5S8_SGWU_IP={{ SGWU_S5S8_SGWU_IP }} 9 | S5S8_PGWU_IP={{ PGWU_S5S8_PGWU_IP }} 10 | S5S8_SGWC_IP={{ SGWC_S5S8_SGWC_IP }} 11 | S5S8_PGWC_IP={{ PGWC_S5S8_PGWC_IP }} 12 | IP_POOL_IP=16.0.0.0 13 | IP_POOL_MASK=255.0.0.0 14 | APN=apn1 15 | #APN=n.ispsn,otasn 16 | MEMORY=1024 17 | #Below parameters are for Socket memory for perticular numa socket 18 | NUMA0_MEMORY=$MEMORY 19 | NUMA1_MEMORY=0 20 | 21 | CORELIST="0-4" 22 | -------------------------------------------------------------------------------- /ansible/roles/pgwc/templates/interface.j2: -------------------------------------------------------------------------------- 1 | ; Copyright (c) 2017 Intel Corporation 2 | ; 3 | ; Licensed under the Apache License, Version 2.0 (the "License"); 4 | ; you may not use this file except in compliance with the License. 5 | ; You may obtain a copy of the License at 6 | ; 7 | ; http://www.apache.org/licenses/LICENSE-2.0 8 | ; 9 | ; Unless required by applicable law or agreed to in writing, software 10 | ; distributed under the License is distributed on an "AS IS" BASIS, 11 | ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | ; See the License for the specific language governing permissions and 13 | ; limitations under the License. 14 | 15 | [0] 16 | ; please refer to INSTALL.MD for complete description of these parameters 17 | zmq_protocol = tcp 18 | 19 | ; zmq publisher and subscriber ip:port. To be configured to an available ip 20 | ; on the FPC Host. The port values are defined by the FPC Project. 21 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 22 | ; ng-core_cfg.mk 23 | zmq_sub_ip = {{ FPC_FPCSB_IP }} 24 | zmq_sub_port = 5560 25 | zmq_pub_ip = {{ FPC_FPCSB_IP }} 26 | zmq_pub_port = 5559 27 | 28 | ; CP and DP communication ip:port: Used for messages to communicate over ZMQ(PUSH/PULL) 29 | ; including table creation, table entries; and when DZMQ_COMM CFLAG is defined and 30 | ; DSDN_ODL_BUILD CFLAG is NOT defined, session establishment, modification, deletion, etc. 31 | ; Ex. CP: zmq_pull_port = 5556, zmq_push_port = 5559 32 | ; DP: zmq_pull_port = 5560, zmq_push_port = 5557 33 | zmq_cp_ip = {{ PGWC_FPCNB_IP }} 34 | zmq_pull_port = 5560 35 | zmq_push_port = 5557 36 | 37 | 38 | ; DP and CP communication ip:port: To be configured to available ip:ports on 39 | ; the DP and CP Hosts respectively. Used for messages to communicate over UDP 40 | ; including table creation, table entries; and when DSDN_ODL_BUILD CFLAG is NOT 41 | ; defined, session establishment, modification, deletion, etc. 42 | dp_comm_ip = {{ PGWU_FPCSB_IP }} 43 | dp_comm_port = 20 44 | cp_comm_ip = {{ PGWC_FPCNB_IP }} 45 | cp_comm_port = 21 46 | 47 | ; FPC ip:port: To be configured to an available IP of FPC host. The fpc_port 48 | ; is defined by the FPC project. 49 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 50 | ; ng-core_cfg.mk 51 | fpc_ip = {{ FPC_FPCNB_IP }} 52 | fpc_port = 8070 53 | fpc_topology_port = 8181 54 | 55 | ; The CP Northbound server ip:port: May be configured to any available ip:port 56 | ; on the CP Host. 57 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 58 | ; ng-core_cfg.mk 59 | cp_nb_ip = {{ PGWC_FPCNB_IP }} 60 | cp_nb_port = 9997 61 | 62 | ; DP and DealerIn communication ip and port to be configured to communicate 63 | ; with with DealerIn. Values of mrenclave, mrsigner and isvsvn required to 64 | ; verify DealerIn. Also values of DP certificate and private key path are 65 | ; required for DP verification by DealerIn.. 66 | #dealer_in_ip = {{ DEALER_IN_IP }} 67 | dealer_in_port = 443 68 | 69 | dealer_in_mrenclave = 2d7738dc35924641d236b879f9473633765206d6ec2df0d519ae384d42b4fe27 70 | dealer_in_mrsigner = 63ef969cbc34ee465f277cd3c27e9b3c681d743e455f899daced1b3cf85ceb8f 71 | dealer_in_isvsvn = 0 72 | 73 | dp_cert_path = conf/cert.pem 74 | dp_pkey_path = conf/key.pem 75 | 76 | -------------------------------------------------------------------------------- /ansible/roles/pgwc/templates/ng-core_cfg.j2: -------------------------------------------------------------------------------- 1 | #SDN_ODL_BUILD flag is set for ODL builds, unset for direct UDP communication 2 | {% if WITH_FPC == 'yes' %} 3 | CFLAGS += -DSDN_ODL_BUILD 4 | 5 | #ZMQ_COMM flag is set for direct ZMQ communication, unset for direct UDP communication 6 | #CFLAGS += -DZMQ_COMM 7 | {% elif WITH_FPC == 'no' %} 8 | #CFLAGS += -DSDN_ODL_BUILD 9 | 10 | #ZMQ_COMM flag is set for direct ZMQ communication, unset for direct UDP communication 11 | CFLAGS += -DZMQ_COMM 12 | {% endif %} 13 | 14 | # ASR- Un-comment below line to shrink pipeline COREs used 15 | CFLAGS += -DNGCORE_SHRINK 16 | -------------------------------------------------------------------------------- /ansible/roles/pgwc/templates/pgwc.service.j2: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description= pgwc service 3 | 4 | [Service] 5 | ExecStart={{ SERVICE_SCRIPT_PATH }} 6 | 7 | [Install] 8 | WantedBy=default.target 9 | -------------------------------------------------------------------------------- /ansible/roles/pgwc/templates/spgwc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ### BEGIN INIT INFO 3 | # Provides: 4 | # Required-Start: $local_fs $network $named $time $syslog 5 | # Required-Stop: $local_fs $network $named $time $syslog 6 | # Default-Start: 2 3 4 5 7 | # Default-Stop: 0 1 6 8 | # Description: 9 | ### END INIT INFO 10 | 11 | SCRIPT=/tmp/ngic-rtc/cp/run.sh 12 | RUNAS=root 13 | 14 | PIDFILE=/var/run/spgwc.pid 15 | LOGFILE=/var/log/spgwc.log 16 | 17 | start() { 18 | if [ -f /var/run/$PIDNAME ] && kill -0 $(cat /var/run/$PIDNAME); then 19 | echo 'Service already running' >&2 20 | return 1 21 | fi 22 | echo 'Starting service…' >&2 23 | local CMD="$SCRIPT &> \"$LOGFILE\" & echo \$!" 24 | su -c "$CMD" $RUNAS > "$PIDFILE" 25 | echo 'Service started' >&2 26 | } 27 | 28 | stop() { 29 | if [ ! -f "$PIDFILE" ] || ! kill -0 $(cat "$PIDFILE"); then 30 | echo 'Service not running' >&2 31 | return 1 32 | fi 33 | echo 'Stopping service…' >&2 34 | kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE" 35 | echo 'Service stopped' >&2 36 | } 37 | 38 | case "$1" in 39 | start) 40 | start 41 | ;; 42 | stop) 43 | stop 44 | ;; 45 | retart) 46 | stop 47 | start 48 | ;; 49 | *) 50 | echo "Usage: $0 {start|stop|restart}" 51 | esac 52 | -------------------------------------------------------------------------------- /ansible/roles/pgwc/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | SERVICE_SCRIPT_PATH: '{{ NGIC_REPO_DIR }}/cp/run.sh' 3 | PGWC_LOG: /var/log/pgwc_install.log 4 | DEALER_IN_IP: 10.212.93.78 5 | -------------------------------------------------------------------------------- /ansible/roles/pgwu/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - setup: 3 | register: host_facts 4 | - set_fact: 5 | temp_var: "{{ ansible_interfaces|sort }}" 6 | - set_fact: 7 | S5S8_PGWU_DEV: "ansible_{{ temp_var[2] }}" 8 | SGI_DEV: "ansible_{{ temp_var[3] }}" 9 | - set_fact: 10 | S5S8_PGWU_PCIID: "{{ host_facts.ansible_facts[S5S8_PGWU_DEV].pciid }}" 11 | S5S8_PGWU_MAC: "{{ host_facts.ansible_facts[S5S8_PGWU_DEV].macaddress }}" 12 | SGI_PCIID: "{{ host_facts.ansible_facts[SGI_DEV].pciid }}" 13 | SGI_MAC: "{{ host_facts.ansible_facts[SGI_DEV].macaddress }}" 14 | - debug: 15 | msg: 16 | - "S5S8 = {{ S5S8_PGWU_DEV }} - {{ S5S8_PGWU_PCIID }} - {{ S5S8_PGWU_MAC }}" 17 | - "SGI = {{ SGI_DEV }} - {{ SGI_PCIID }} - {{ SGI_MAC }}" 18 | 19 | - name: Get PCIID of VF S5S8 interface 20 | shell: lshw -c network -businfo | grep Virtio | awk '{print $1}' |cut -d '@' -f2 | tail -n 1 21 | register: pgwu_s5s8_pciid 22 | - debug: 23 | msg: 24 | - "PGWU_S5S8_PCIID: {{ pgwu_s5s8_pciid.stdout_lines[0] }}" 25 | 26 | - name: Git clone for NGIC-RTC 27 | git: 28 | repo: "{{ NGIC_REPO }}" 29 | dest: "{{ NGIC_REPO_DIR }}" 30 | version: "{{ NGIC_COMMIT_ID }}" 31 | update: no 32 | 33 | - name: Installing libs 34 | apt: 35 | name: "{{ item }}" 36 | state: present 37 | with_items: 38 | - curl 39 | - build-essential 40 | - linux-headers-{{ ansible_kernel }} 41 | - unzip 42 | - libpcap0.8-dev 43 | - gcc 44 | - libjson0-dev 45 | - make 46 | - libc6 47 | - libc6-dev 48 | - g++-multilib 49 | - libzmq3-dev 50 | - libcurl4-openssl-dev 51 | - libssl-dev 52 | - cmake 53 | 54 | - name: copying ansible install pgwu build script 55 | template: 56 | # src: ansible_install_pgwu.j2 57 | # dest: "{{ NGIC_REPO_DIR }}/ansible_install_pgwu.sh" 58 | src: build.j2 59 | dest: "{{ NGIC_REPO_DIR }}/build.sh" 60 | owner: "root" 61 | mode: "0755" 62 | 63 | - name: copying pgwu configuration files 64 | template: 65 | src: "{{ item.src }}" 66 | dest: "{{ item.dest }}" 67 | backup: yes 68 | with_items: 69 | - { src: 'dp_config.j2', dest: '/{{ NGIC_REPO_DIR }}/config/dp_config.cfg' } 70 | - { src: 'interface.j2', dest: '/{{ NGIC_REPO_DIR }}/config/interface.cfg' } 71 | # - { src: 'ng-core_cfg.j2', dest: '{{ NGIC_REPO_DIR }}/config/ng-core_cfg.mk' } 72 | # - { src: 'Makefile1.j2', dest: '{{ NGIC_REPO_DIR }}/dp/Makefile' } 73 | 74 | - name: Run the installation script 75 | shell: cd {{ NGIC_REPO_DIR }} && ./ansible_install_pgwu.sh dp |tee {{ PGWU_LOG }} 76 | args: 77 | executable: /bin/bash 78 | 79 | - name: DPDK Binding for SGI Interface 80 | shell: python {{ NGIC_REPO_DIR }}/dpdk/usertools/dpdk-devbind.py -b igb_uio {{ SGI_PCIID }} {{ S5S8_PGWU_PCIID }} 81 | register: result 82 | - debug: 83 | var: result 84 | -------------------------------------------------------------------------------- /ansible/roles/pgwu/templates/Makefile.j2: -------------------------------------------------------------------------------- 1 | ifeq ($(RTE_SDK),) 2 | $(error "Please define RTE_SDK environment variable") 3 | endif 4 | MAKEFLAGS += -j 5 | RTE_TARGET ?= x86_64-native-linuxapp-gcc 6 | include $(RTE_SDK)/mk/rte.vars.mk 7 | include $(NG_CORE)/config/ng-core_cfg.mk 8 | APP = ngic_dataplane 9 | SRCS-y := main.c\ 10 | pkt_handler.c\ 11 | cdr.c\ 12 | master_cdr.c\ 13 | session_cdr.c\ 14 | config.c\ 15 | init.c\ 16 | dataplane.c\ 17 | gtpu.c\ 18 | ether.c\ 19 | ipv4.c\ 20 | util.c\ 21 | acl.c\ 22 | meter.c\ 23 | adc_table.c\ 24 | pcc_table.c\ 25 | sess_table.c\ 26 | commands.c\ 27 | stats.c\ 28 | ddn_utils.c\ 29 | extended_cdr.c\ 30 | timer_stats.c\ 31 | kni_pkt_handler.c\ 32 | gtpu_echo.c\ 33 | pipeline/epc_packet_framework.o\ 34 | pipeline/epc_arp.o\ 35 | pipeline/epc_spns_dns.o\ 36 | $(SRCDIR)/../interface/interface.o\ 37 | $(SRCDIR)/../cp_dp_api/vepc_cp_dp_api.o\ 38 | $(SRCDIR)/../test/simu_cp/nsb/nsb_test_util.o\ 39 | $(SRCDIR)/../test/simu_cp/simu_cp.o\ 40 | $(SRCDIR)/../test/simu_cp/pkt_filtrs.o\ 41 | $(SRCDIR)/../interface/ipc/dp_ipc_api.o\ 42 | $(SRCDIR)/../interface/udp/vepc_udp.o\ 43 | CFLAGS += -I$(SRCDIR)/ 44 | CFLAGS += -I$(SRCDIR)/../interface 45 | CFLAGS += -I$(SRCDIR)/../interface/ipc 46 | CFLAGS += -I$(SRCDIR)/../interface/udp 47 | CFLAGS += -I$(SRCDIR)/../interface/sdn 48 | CFLAGS += -I$(SRCDIR)/../interface/zmq 49 | CFLAGS += -I$(SRCDIR)/../cp_dp_api 50 | CFLAGS += -I$(SRCDIR)/../test/simu_cp 51 | CFLAGS += -I$(SRCDIR)/../test/simu_cp/nsb 52 | CFLAGS += -I$(SRCDIR)/pipeline 53 | CFLAGS += -I$(SRCDIR)/../cp 54 | CFLAGS += -I$(SRCDIR)/../lib/libsponsdn 55 | CFLAGS += -Wno-psabi # suppress "The ABI for passing parameters with 64-byte alignment has changed in GCC 4.6" 56 | CFLAGS += -DLDB_DP # should be included for dataplane. 57 | ifneq (,$(findstring NGCORE_SHRINK, $(CFLAGS))) 58 | SRCS-y += pipeline/epc_ul.o 59 | SRCS-y += pipeline/epc_dl.o 60 | else 61 | SRCS-y += pipeline/epc_rx.o\ 62 | pipeline/epc_tx.o\ 63 | pipeline/epc_load_balance.o\ 64 | pipeline/epc_worker.o 65 | endif 66 | ifneq (,$(findstring SDN_ODL_BUILD, $(CFLAGS))) 67 | SRCS-y += $(SRCDIR)/../interface/zmq/zmqsub.o 68 | SRCS-y += $(SRCDIR)/../interface/zmq/zmqpub.o 69 | LDFLAGS += -L/usr/local/lib -lzmq 70 | endif 71 | ifeq ($(SGX_BUILD), 1) 72 | SRCS-y += ssl_client.c 73 | CFLAGS += -DSGX_CDR 74 | CFLAGS += -I$(NG_CORE)/linux-sgx/common/inc 75 | LDFLAGS += -lssl 76 | endif 77 | CFLAGS += -O3 78 | {% if FLAG_DSTATIC_ARP == true %} 79 | CFLAGS += -DSTATIC_ARP 80 | {% else %} 81 | #CFLAGS += -DSTATIC_ARP 82 | {% endif %} 83 | ifneq (,$(findstring SIMU_CP, $(CFLAGS))) 84 | SRCS-y += $(SRCDIR)/../cp/cp_stats.o 85 | endif 86 | CFLAGS += -DSTATS 87 | CFLAGS += -DDP_TABLE_CONFIG 88 | {% if FLAG_DPERF_TEST == true %} 89 | CFLAGS += -DPERF_TEST 90 | {% else %} 91 | #CFLAGS += -DPERF_TEST 92 | {% endif %} 93 | CFLAGS += -Werror 94 | CFLAGS += -Wunused-variable 95 | CFLAGS_config.o := -D_GNU_SOURCE 96 | ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) 97 | CFLAGS_dataplane.o += -Wno-return-type 98 | endif 99 | LDFLAGS += -L$(RTE_SRCDIR)/../lib/libsponsdn/x86_64-native-linuxapp-gcc/ -lsponsdn 100 | LDFLAGS += -L$(HYPERSCANDIR)/build/lib 101 | LDFLAGS += -lexpressionutil -lhs -lhs_runtime -lstdc++ -lm -lcrypto 102 | LDFLAGS += -lrte_pmd_af_packet 103 | LDFLAGS += -lpcap 104 | include $(RTE_SDK)/mk/rte.extapp.mk 105 | -------------------------------------------------------------------------------- /ansible/roles/pgwu/templates/dp_config.j2: -------------------------------------------------------------------------------- 1 | NOW=$(date +"%Y-%m-%d_%H-%M") 2 | FILE="logs/dp_$NOW.log" 3 | #######[KNI-INTERFACE-NAMES]####### 4 | ##S1U INTERFACE## 5 | UL_IFACE="S1Udev" 6 | ##SGI INTERFACE## 7 | DL_IFACE="SGIdev" 8 | #dp configure parameter selections 9 | #SPGW_CFG:: SGWU=01; PGWU=02; SPGWU=03 10 | # 11 | #Example configurations as per selected SPGW_CFG is given below. 12 | #Uncomment the section of parameters based on PGW_CFG configuration: 13 | # 14 | #####[SGWU]##### 15 | #SPGW_CFG=01 16 | #S1U_PORT=0000:00:05.0 17 | #S5S8_SGWU_PORT=0000:00:06.0 18 | #S1U_IP=11.1.1.93 19 | #S1U_MAC=ea:c3:4f:bf:ac:a6 20 | #S5S8_SGWU_IP=12.1.1.93 21 | #S5S8_SGWU_MAC=c2:9c:ff:7c:2a:38 22 | 23 | #####[PGWU]##### 24 | SPGW_CFG=02 25 | #S5S8_PGWU_PORT={{ S5S8_PGWU_PCIID }} 26 | S5S8_PGWU_PORT={{ pgwu_s5s8_pciid.stdout_lines[0] }} 27 | SGI_PORT={{ SGI_PCIID }} 28 | S5S8_PGWU_IP={{ PGWU_S5S8_PGWU_IP }} 29 | S5S8_PGWU_MAC={{ S5S8_PGWU_MAC }} 30 | SGI_IP={{ SPGWU_SGI_IP }} 31 | SGI_MAC={{ SGI_MAC }} 32 | 33 | NUM_WORKER=1 34 | MEMORY=4096 35 | 36 | #Set 1 to enabled numa, otherwise set to 0 37 | NUMA=0 38 | 39 | #Give numa memory according to numa1 or numa0 socket 40 | NUMA0_MEMORY=$MEMORY 41 | NUMA1_MEMORY=0 42 | 43 | #set corelist here 44 | CORELIST="0-3" 45 | #Optional: 46 | #SGI_GW_IP=13.1.1.110 47 | #SGI_MASK=255.255.0.0 48 | 49 | #S1U_GW_IP=11.1.1.101 50 | #S1U_MASK=255.255.0.0 51 | -------------------------------------------------------------------------------- /ansible/roles/pgwu/templates/interface.j2: -------------------------------------------------------------------------------- 1 | ; Copyright (c) 2017 Intel Corporation 2 | ; 3 | ; Licensed under the Apache License, Version 2.0 (the "License"); 4 | ; you may not use this file except in compliance with the License. 5 | ; You may obtain a copy of the License at 6 | ; 7 | ; http://www.apache.org/licenses/LICENSE-2.0 8 | ; 9 | ; Unless required by applicable law or agreed to in writing, software 10 | ; distributed under the License is distributed on an "AS IS" BASIS, 11 | ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | ; See the License for the specific language governing permissions and 13 | ; limitations under the License. 14 | 15 | [0] 16 | ; please refer to INSTALL.MD for complete description of these parameters 17 | zmq_protocol = tcp 18 | 19 | ; zmq publisher and subscriber ip:port. To be configured to an available ip 20 | ; on the FPC Host. The port values are defined by the FPC Project. 21 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 22 | ; ng-core_cfg.mk 23 | zmq_sub_ip = {{ FPC_FPCSB_IP }} 24 | zmq_sub_port = 5560 25 | zmq_pub_ip = {{ FPC_FPCSB_IP }} 26 | zmq_pub_port = 5559 27 | 28 | ; CP and DP communication ip:port: Used for messages to communicate over ZMQ(PUSH/PULL) 29 | ; including table creation, table entries; and when DZMQ_COMM CFLAG is defined and 30 | ; DSDN_ODL_BUILD CFLAG is NOT defined, session establishment, modification, deletion, etc. 31 | ; Ex. CP: zmq_pull_port = 5556, zmq_push_port = 5559 32 | ; DP: zmq_pull_port = 5560, zmq_push_port = 5557 33 | zmq_cp_ip = {{ PGWC_FPCNB_IP }} 34 | zmq_pull_port = 5560 35 | zmq_push_port = 5557 36 | 37 | 38 | ; DP and CP communication ip:port: To be configured to available ip:ports on 39 | ; the DP and CP Hosts respectively. Used for messages to communicate over UDP 40 | ; including table creation, table entries; and when DSDN_ODL_BUILD CFLAG is NOT 41 | ; defined, session establishment, modification, deletion, etc. 42 | dp_comm_ip = {{ PGWU_FPCSB_IP }} 43 | dp_comm_port = 20 44 | cp_comm_ip = {{ PGWC_FPCNB_IP }} 45 | cp_comm_port = 21 46 | 47 | ; FPC ip:port: To be configured to an available IP of FPC host. The fpc_port 48 | ; is defined by the FPC project. 49 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 50 | ; ng-core_cfg.mk 51 | fpc_ip = {{ FPC_FPCSB_IP }} 52 | fpc_port = 8070 53 | fpc_topology_port = 8181 54 | 55 | ; The CP Northbound server ip:port: May be configured to any available ip:port 56 | ; on the CP Host. 57 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 58 | ; ng-core_cfg.mk 59 | cp_nb_ip = {{ PGWC_FPCNB_IP }} 60 | cp_nb_port = 9997 61 | 62 | ; DP and DealerIn communication ip and port to be configured to communicate 63 | ; with with DealerIn. Values of mrenclave, mrsigner and isvsvn required to 64 | ; verify DealerIn. Also values of DP certificate and private key path are 65 | ; required for DP verification by DealerIn.. 66 | {% if SGX_BUILD == 'true' %} 67 | dealer_in_ip = {{ SGX_DLRIN_SGX_DLRIN_IP }} 68 | dealer_in_port = {{ DL_IN_PORT }} 69 | dealer_in_mrenclave = {{ hostvars[groups['sgx-dealer-in'][0]]['DLIN_MRENCLAVE'] }} 70 | dealer_in_mrsigner = {{ hostvars[groups['sgx-dealer-in'][0]]['DLIN_MRSIGNER'] }} 71 | dealer_in_isvsvn = {{ ISVSVN }} 72 | {% else %} 73 | #dealer_in_ip = {{ SGX_DLRIN_SGX_DLRIN_IP }} 74 | dealer_in_port = {{ DL_IN_PORT }} 75 | dealer_in_mrenclave = 2d7738dc35924641d236b879f9473633765206d6ec2df0d519ae384d42b4fe27 76 | dealer_in_mrsigner = 63ef969cbc34ee465f277cd3c27e9b3c681d743e455f899daced1b3cf85ceb8f 77 | dealer_in_isvsvn = 0 78 | {% endif %} 79 | 80 | dp_cert_path = conf/cert.pem 81 | dp_pkey_path = conf/key.pem 82 | 83 | -------------------------------------------------------------------------------- /ansible/roles/pgwu/templates/ng-core_cfg.j2: -------------------------------------------------------------------------------- 1 | #SDN_ODL_BUILD flag is set for ODL builds, unset for direct UDP communication 2 | {% if WITH_FPC == 'yes' %} 3 | CFLAGS += -DSDN_ODL_BUILD 4 | 5 | #ZMQ_COMM flag is set for direct ZMQ communication, unset for direct UDP communication 6 | #CFLAGS += -DZMQ_COMM 7 | {% elif WITH_FPC == 'no' %} 8 | #CFLAGS += -DSDN_ODL_BUILD 9 | 10 | #ZMQ_COMM flag is set for direct ZMQ communication, unset for direct UDP communication 11 | CFLAGS += -DZMQ_COMM 12 | {% endif %} 13 | 14 | # ASR- Un-comment below line to shrink pipeline COREs used 15 | CFLAGS += -DNGCORE_SHRINK 16 | -------------------------------------------------------------------------------- /ansible/roles/pgwu/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | FLAG_DSTATIC_ARP: true 3 | FLAG_DPERF_TEST: true 4 | PGWU_LOG: /var/log/pgwu_install.log 5 | -------------------------------------------------------------------------------- /ansible/roles/sgwc/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Git clone for NGIC-RTC 3 | git: 4 | repo: "{{ NGIC_REPO }}" 5 | dest: "{{ NGIC_REPO_DIR }}" 6 | version: "{{ NGIC_COMMIT_ID }}" 7 | update: no 8 | 9 | - name: copying build script 10 | copy: 11 | src: build.sh 12 | dest: "{{ NGIC_REPO_DIR }}/" 13 | owner: "root" 14 | mode: "0755" 15 | 16 | - name: copying sgwc configuration files 17 | template: 18 | src: "{{ item.src }}" 19 | dest: "{{ item.dest }}" 20 | backup: yes 21 | with_items: 22 | - { src: 'cp_config.j2', dest: '/{{ NGIC_REPO_DIR }}/config/cp_config.cfg' } 23 | - { src: 'interface.j2', dest: '/{{ NGIC_REPO_DIR }}/config/interface.cfg' } 24 | # - { src: 'ng-core_cfg.j2', dest: '{{ NGIC_REPO_DIR }}/config/ng-core_cfg.mk' } 25 | # - { src: 'run_sgwc.j2', dest: '{{ SERVICE_SCRIPT_PATH }}' } 26 | # - { src: 'sgwc.service.j2', dest: '/etc/systemd/system/sgwc.service' } 27 | 28 | # - name: systemctl daemon-reload and set permission sgwc service 29 | # shell: chmod +x {{ SERVICE_SCRIPT_PATH }} && systemctl daemon-reload 30 | # args: 31 | # executable: /bin/bash 32 | 33 | - name: Run the installation script 34 | shell: cd {{ NGIC_REPO_DIR }} && ./build.sh cp |tee {{ SGWC_LOG }} 35 | args: 36 | executable: /bin/bash 37 | 38 | # - name: staring sgwc service 39 | # service: 40 | # name: sgwc 41 | # state: started 42 | -------------------------------------------------------------------------------- /ansible/roles/sgwc/templates/cp_config.j2: -------------------------------------------------------------------------------- 1 | NOW=$(date +"%Y-%m-%d_%H-%M") 2 | FILE="logs/cp_$NOW.log" 3 | #SPGW_CFG:: SGWC=01; PGWC=02; SPGWC=03 4 | SPGW_CFG=01 5 | S11_MME_IP={{ MME_S11_IP }} 6 | S11_SGW_IP={{ SGWC_S11_IP }} 7 | S1U_SGW_IP={{ SGWU_S1U_IP }} 8 | S5S8_SGWU_IP={{ SGWU_S5S8_SGWU_IP }} 9 | S5S8_PGWU_IP={{ PGWU_S5S8_PGWU_IP }} 10 | S5S8_SGWC_IP={{ SGWC_S5S8_SGWC_IP }} 11 | S5S8_PGWC_IP={{ PGWC_S5S8_PGWC_IP }} 12 | IP_POOL_IP=16.0.0.0 13 | IP_POOL_MASK=255.0.0.0 14 | APN=apn1 15 | #APN=n.ispsn,otasn 16 | MEMORY=1024 17 | #Below parameters are for Socket memory for perticular numa socket 18 | NUMA0_MEMORY=$MEMORY 19 | NUMA1_MEMORY=0 20 | 21 | CORELIST="0-4" 22 | -------------------------------------------------------------------------------- /ansible/roles/sgwc/templates/interface.j2: -------------------------------------------------------------------------------- 1 | ; Copyright (c) 2017 Intel Corporation 2 | ; 3 | ; Licensed under the Apache License, Version 2.0 (the "License"); 4 | ; you may not use this file except in compliance with the License. 5 | ; You may obtain a copy of the License at 6 | ; 7 | ; http://www.apache.org/licenses/LICENSE-2.0 8 | ; 9 | ; Unless required by applicable law or agreed to in writing, software 10 | ; distributed under the License is distributed on an "AS IS" BASIS, 11 | ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | ; See the License for the specific language governing permissions and 13 | ; limitations under the License. 14 | 15 | [0] 16 | ; please refer to INSTALL.MD for complete description of these parameters 17 | zmq_protocol = tcp 18 | 19 | ; zmq publisher and subscriber ip:port. To be configured to an available ip 20 | ; on the FPC Host. The port values are defined by the FPC Project. 21 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 22 | ; ng-core_cfg.mk 23 | zmq_sub_ip = {{ FPC_FPCSB_IP }} 24 | zmq_sub_port = 5560 25 | zmq_pub_ip = {{ FPC_FPCSB_IP }} 26 | zmq_pub_port = 5559 27 | 28 | ; CP and DP communication ip:port: Used for messages to communicate over ZMQ(PUSH/PULL) 29 | ; including table creation, table entries; and when DZMQ_COMM CFLAG is defined and 30 | ; DSDN_ODL_BUILD CFLAG is NOT defined, session establishment, modification, deletion, etc. 31 | ; Ex. CP: zmq_pull_port = 5556, zmq_push_port = 5559 32 | ; DP: zmq_pull_port = 5560, zmq_push_port = 5557 33 | zmq_cp_ip = {{ SGWC_FPCNB_IP }} 34 | zmq_pull_port = 5560 35 | zmq_push_port = 5557 36 | 37 | ; DP and CP communication ip:port: To be configured to available ip:ports on 38 | ; the DP and CP Hosts respectively. Used for messages to communicate over UDP 39 | ; including table creation, table entries; and when DSDN_ODL_BUILD CFLAG is NOT 40 | ; defined, session establishment, modification, deletion, etc. 41 | dp_comm_ip = {{ SGWU_FPCSB_IP }} 42 | dp_comm_port = 20 43 | cp_comm_ip = {{ SGWC_FPCNB_IP }} 44 | cp_comm_port = 21 45 | 46 | ; FPC ip:port: To be configured to an available IP of FPC host. The fpc_port 47 | ; is defined by the FPC project. 48 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 49 | ; ng-core_cfg.mk 50 | fpc_ip = {{ FPC_FPCNB_IP }} 51 | fpc_port = 8070 52 | fpc_topology_port = 8181 53 | 54 | ; The CP Northbound server ip:port: May be configured to any available ip:port 55 | ; on the CP Host. 56 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 57 | ; ng-core_cfg.mk 58 | cp_nb_ip = {{ SGWC_FPCNB_IP }} 59 | cp_nb_port = 9997 60 | 61 | ; DP and DealerIn communication ip and port to be configured to communicate 62 | ; with with DealerIn. Values of mrenclave, mrsigner and isvsvn required to 63 | ; verify DealerIn. Also values of DP certificate and private key path are 64 | ; required for DP verification by DealerIn.. 65 | #dealer_in_ip = {{ DEALER_IN_IP }} 66 | dealer_in_port = 443 67 | 68 | dealer_in_mrenclave = 2d7738dc35924641d236b879f9473633765206d6ec2df0d519ae384d42b4fe27 69 | dealer_in_mrsigner = 63ef969cbc34ee465f277cd3c27e9b3c681d743e455f899daced1b3cf85ceb8f 70 | dealer_in_isvsvn = 0 71 | 72 | dp_cert_path = conf/cert.pem 73 | dp_pkey_path = conf/key.pem 74 | 75 | -------------------------------------------------------------------------------- /ansible/roles/sgwc/templates/ng-core_cfg.j2: -------------------------------------------------------------------------------- 1 | #SDN_ODL_BUILD flag is set for ODL builds, unset for direct UDP communication 2 | {% if WITH_FPC == 'yes' %} 3 | CFLAGS += -DSDN_ODL_BUILD 4 | 5 | #ZMQ_COMM flag is set for direct ZMQ communication, unset for direct UDP communication 6 | #CFLAGS += -DZMQ_COMM 7 | {% elif WITH_FPC == 'no' %} 8 | #CFLAGS += -DSDN_ODL_BUILD 9 | 10 | #ZMQ_COMM flag is set for direct ZMQ communication, unset for direct UDP communication 11 | CFLAGS += -DZMQ_COMM 12 | {% endif %} 13 | 14 | # ASR- Un-comment below line to shrink pipeline COREs used 15 | CFLAGS += -DNGCORE_SHRINK 16 | -------------------------------------------------------------------------------- /ansible/roles/sgwc/templates/sgwc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ### BEGIN INIT INFO 3 | # Provides: 4 | # Required-Start: $local_fs $network $named $time $syslog 5 | # Required-Stop: $local_fs $network $named $time $syslog 6 | # Default-Start: 2 3 4 5 7 | # Default-Stop: 0 1 6 8 | # Description: 9 | ### END INIT INFO 10 | 11 | SCRIPT=/tmp/ngic-rtc/cp/run.sh 12 | RUNAS=root 13 | 14 | PIDFILE=/var/run/sgwc.pid 15 | LOGFILE=/var/log/sgwc.log 16 | 17 | start() { 18 | if [ -f /var/run/$PIDNAME ] && kill -0 $(cat /var/run/$PIDNAME); then 19 | echo 'Service already running' >&2 20 | return 1 21 | fi 22 | echo 'Starting service…' >&2 23 | local CMD="$SCRIPT &> \"$LOGFILE\" & echo \$!" 24 | su -c "$CMD" $RUNAS > "$PIDFILE" 25 | echo 'Service started' >&2 26 | } 27 | 28 | stop() { 29 | if [ ! -f "$PIDFILE" ] || ! kill -0 $(cat "$PIDFILE"); then 30 | echo 'Service not running' >&2 31 | return 1 32 | fi 33 | echo 'Stopping service…' >&2 34 | kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE" 35 | echo 'Service stopped' >&2 36 | } 37 | 38 | case "$1" in 39 | start) 40 | start 41 | ;; 42 | stop) 43 | stop 44 | ;; 45 | retart) 46 | stop 47 | start 48 | ;; 49 | *) 50 | echo "Usage: $0 {start|stop|restart}" 51 | esac 52 | -------------------------------------------------------------------------------- /ansible/roles/sgwc/templates/sgwc.service.j2: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description= sgwc service 3 | 4 | [Service] 5 | ExecStart={{ SERVICE_SCRIPT_PATH }} 6 | 7 | [Install] 8 | WantedBy=default.target 9 | -------------------------------------------------------------------------------- /ansible/roles/sgwc/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | SERVICE_SCRIPT_PATH: "{{ NGIC_REPO_DIR }}/cp/run.sh" 3 | SGWC_LOG: /var/log/sgwc_install.log 4 | DEALER_IN_IP: 10.212.93.78 5 | -------------------------------------------------------------------------------- /ansible/roles/sgwu/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - setup: 3 | register: host_facts 4 | - set_fact: 5 | temp_var: "{{ ansible_interfaces|sort }}" 6 | - set_fact: 7 | S5S8_SGWU_DEV: "ansible_{{ temp_var[2] }}" 8 | S1U_DEV: "ansible_{{ temp_var[3] }}" 9 | - set_fact: 10 | S5S8_SGWU_PCIID: "{{ host_facts.ansible_facts[S5S8_SGWU_DEV].pciid }}" 11 | S5S8_SGWU_MAC: "{{ host_facts.ansible_facts[S5S8_SGWU_DEV].macaddress }}" 12 | S1U_PCIID: "{{ host_facts.ansible_facts[S1U_DEV].pciid }}" 13 | S1U_MAC: "{{ host_facts.ansible_facts[S1U_DEV].macaddress }}" 14 | - debug: 15 | msg: 16 | - "S1U = {{ S1U_DEV }} - {{ S1U_PCIID }} - {{ S1U_MAC }}" 17 | - "S5S8 = {{ S5S8_SGWU_DEV }} - {{ S5S8_SGWU_PCIID }} - {{ S5S8_SGWU_MAC }}" 18 | 19 | - name: Get PCIID of VF S5S8 interface 20 | shell: lshw -c network -businfo | grep Virtio | awk '{print $1}' |cut -d '@' -f2 | tail -n 1 21 | register: sgwu_s5s8_pciid 22 | - debug: 23 | msg: 24 | - "SGWU_S5S8_PCIID: {{ sgwu_s5s8_pciid.stdout_lines[0] }}" 25 | 26 | - name: Git clone for NGIC-RTC 27 | git: 28 | repo: "{{ NGIC_REPO }}" 29 | dest: "{{ NGIC_REPO_DIR }}" 30 | version: "{{ NGIC_COMMIT_ID }}" 31 | update: no 32 | 33 | - name: Installing libs 34 | apt: 35 | name: "{{ item }}" 36 | state: present 37 | with_items: 38 | - curl 39 | - build-essential 40 | - linux-headers-{{ ansible_kernel }} 41 | - unzip 42 | - libpcap0.8-dev 43 | - gcc 44 | - libjson0-dev 45 | - make 46 | - libc6 47 | - libc6-dev 48 | - g++-multilib 49 | - libzmq3-dev 50 | - libcurl4-openssl-dev 51 | - libssl-dev 52 | - cmake 53 | 54 | - name: copying ansible install sgwu build script 55 | template: 56 | # src: ansible_install_sgwu.j2 57 | # dest: "{{ NGIC_REPO_DIR }}/ansible_install_sgwu.sh" 58 | src: build.j2 59 | dest: "{{ NGIC_REPO_DIR }}/build.sh" 60 | owner: "root" 61 | mode: "0755" 62 | 63 | - name: copying sgwu configuration files 64 | template: 65 | src: "{{ item.src }}" 66 | dest: "{{ item.dest }}" 67 | backup: yes 68 | with_items: 69 | - { src: 'dp_config.j2', dest: '/{{ NGIC_REPO_DIR }}/config/dp_config.cfg' } 70 | - { src: 'interface.j2', dest: '/{{ NGIC_REPO_DIR }}/config/interface.cfg' } 71 | # - { src: 'ng-core_cfg.j2', dest: '{{ NGIC_REPO_DIR }}/config/ng-core_cfg.mk' } 72 | # - { src: 'Makefile1.j2', dest: '{{ NGIC_REPO_DIR }}/dp/Makefile' } 73 | 74 | - name: Run the installation script 75 | # shell: cd {{ NGIC_REPO_DIR }} && ./ansible_install_sgwu.sh dp |tee {{ SGWU_LOG }} 76 | shell: cd {{ NGIC_REPO_DIR }} && ./build.sh dp |tee {{ SGWU_LOG }} 77 | args: 78 | executable: /bin/bash 79 | 80 | - name: DPDK Binding for S1U Interface 81 | shell: python {{ NGIC_REPO_DIR }}/dpdk/usertools/dpdk-devbind.py -b igb_uio {{ S1U_PCIID }} {{ S5S8_SGWU_PCIID }} 82 | register: result 83 | - debug: 84 | var: result 85 | 86 | -------------------------------------------------------------------------------- /ansible/roles/sgwu/templates/Makefile.j2: -------------------------------------------------------------------------------- 1 | ifeq ($(RTE_SDK),) 2 | $(error "Please define RTE_SDK environment variable") 3 | endif 4 | MAKEFLAGS += -j 5 | RTE_TARGET ?= x86_64-native-linuxapp-gcc 6 | include $(RTE_SDK)/mk/rte.vars.mk 7 | include $(NG_CORE)/config/ng-core_cfg.mk 8 | APP = ngic_dataplane 9 | SRCS-y := main.c\ 10 | pkt_handler.c\ 11 | cdr.c\ 12 | master_cdr.c\ 13 | session_cdr.c\ 14 | config.c\ 15 | init.c\ 16 | dataplane.c\ 17 | gtpu.c\ 18 | ether.c\ 19 | ipv4.c\ 20 | util.c\ 21 | acl.c\ 22 | meter.c\ 23 | adc_table.c\ 24 | pcc_table.c\ 25 | sess_table.c\ 26 | commands.c\ 27 | stats.c\ 28 | ddn_utils.c\ 29 | extended_cdr.c\ 30 | timer_stats.c\ 31 | kni_pkt_handler.c\ 32 | gtpu_echo.c\ 33 | pipeline/epc_packet_framework.o\ 34 | pipeline/epc_arp.o\ 35 | pipeline/epc_spns_dns.o\ 36 | $(SRCDIR)/../interface/interface.o\ 37 | $(SRCDIR)/../cp_dp_api/vepc_cp_dp_api.o\ 38 | $(SRCDIR)/../test/simu_cp/nsb/nsb_test_util.o\ 39 | $(SRCDIR)/../test/simu_cp/simu_cp.o\ 40 | $(SRCDIR)/../test/simu_cp/pkt_filtrs.o\ 41 | $(SRCDIR)/../interface/ipc/dp_ipc_api.o\ 42 | $(SRCDIR)/../interface/udp/vepc_udp.o\ 43 | CFLAGS += -I$(SRCDIR)/ 44 | CFLAGS += -I$(SRCDIR)/../interface 45 | CFLAGS += -I$(SRCDIR)/../interface/ipc 46 | CFLAGS += -I$(SRCDIR)/../interface/udp 47 | CFLAGS += -I$(SRCDIR)/../interface/sdn 48 | CFLAGS += -I$(SRCDIR)/../interface/zmq 49 | CFLAGS += -I$(SRCDIR)/../cp_dp_api 50 | CFLAGS += -I$(SRCDIR)/../test/simu_cp 51 | CFLAGS += -I$(SRCDIR)/../test/simu_cp/nsb 52 | CFLAGS += -I$(SRCDIR)/pipeline 53 | CFLAGS += -I$(SRCDIR)/../cp 54 | CFLAGS += -I$(SRCDIR)/../lib/libsponsdn 55 | CFLAGS += -Wno-psabi # suppress "The ABI for passing parameters with 64-byte alignment has changed in GCC 4.6" 56 | CFLAGS += -DLDB_DP # should be included for dataplane. 57 | ifneq (,$(findstring NGCORE_SHRINK, $(CFLAGS))) 58 | SRCS-y += pipeline/epc_ul.o 59 | SRCS-y += pipeline/epc_dl.o 60 | else 61 | SRCS-y += pipeline/epc_rx.o\ 62 | pipeline/epc_tx.o\ 63 | pipeline/epc_load_balance.o\ 64 | pipeline/epc_worker.o 65 | endif 66 | ifneq (,$(findstring SDN_ODL_BUILD, $(CFLAGS))) 67 | SRCS-y += $(SRCDIR)/../interface/zmq/zmqsub.o 68 | SRCS-y += $(SRCDIR)/../interface/zmq/zmqpub.o 69 | LDFLAGS += -L/usr/local/lib -lzmq 70 | endif 71 | ifeq ($(SGX_BUILD), 1) 72 | SRCS-y += ssl_client.c 73 | CFLAGS += -DSGX_CDR 74 | CFLAGS += -I$(NG_CORE)/linux-sgx/common/inc 75 | LDFLAGS += -lssl 76 | endif 77 | CFLAGS += -O3 78 | {% if FLAG_DSTATIC_ARP == true %} 79 | CFLAGS += -DSTATIC_ARP 80 | {% else %} 81 | #CFLAGS += -DSTATIC_ARP 82 | {% endif %} 83 | ifneq (,$(findstring SIMU_CP, $(CFLAGS))) 84 | SRCS-y += $(SRCDIR)/../cp/cp_stats.o 85 | endif 86 | CFLAGS += -DSTATS 87 | CFLAGS += -DDP_TABLE_CONFIG 88 | {% if FLAG_DPERF_TEST == true %} 89 | CFLAGS += -DPERF_TEST 90 | {% else %} 91 | #CFLAGS += -DPERF_TEST 92 | {% endif %} 93 | CFLAGS += -Werror 94 | CFLAGS += -Wunused-variable 95 | CFLAGS_config.o := -D_GNU_SOURCE 96 | ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) 97 | CFLAGS_dataplane.o += -Wno-return-type 98 | endif 99 | LDFLAGS += -L$(RTE_SRCDIR)/../lib/libsponsdn/x86_64-native-linuxapp-gcc/ -lsponsdn 100 | LDFLAGS += -L$(HYPERSCANDIR)/build/lib 101 | LDFLAGS += -lexpressionutil -lhs -lhs_runtime -lstdc++ -lm -lcrypto 102 | LDFLAGS += -lrte_pmd_af_packet 103 | LDFLAGS += -lpcap 104 | include $(RTE_SDK)/mk/rte.extapp.mk 105 | -------------------------------------------------------------------------------- /ansible/roles/sgwu/templates/dp_config.j2: -------------------------------------------------------------------------------- 1 | NOW=$(date +"%Y-%m-%d_%H-%M") 2 | FILE="logs/dp_$NOW.log" 3 | #######[KNI-INTERFACE-NAMES]####### 4 | ##S1U INTERFACE## 5 | UL_IFACE="S1Udev" 6 | ##SGI INTERFACE## 7 | DL_IFACE="SGIdev" 8 | #dp configure parameter selections 9 | #SPGW_CFG:: SGWU=01; PGWU=02; SPGWU=03 10 | # 11 | #Example configurations as per selected SPGW_CFG is given below. 12 | #Uncomment the section of parameters based on PGW_CFG configuration: 13 | # 14 | #####[SGWU]##### 15 | SPGW_CFG=01 16 | S1U_PORT={{ S1U_PCIID }} 17 | #S5S8_SGWU_PORT={{ S5S8_SGWU_PCIID }} 18 | S5S8_SGWU_PORT={{ sgwu_s5s8_pciid.stdout_lines[0] }} 19 | S1U_IP={{ SGWU_S1U_IP }} 20 | S1U_MAC={{ S1U_MAC }} 21 | S5S8_SGWU_IP={{ SGWU_S5S8_SGWU_IP }} 22 | S5S8_SGWU_MAC={{ S5S8_SGWU_MAC }} 23 | SGW_S5S8GW_MASK= 24 | SGW_S5S8GW_IP= 25 | #####[PGWU]##### 26 | #SPGW_CFG=02 27 | #S5S8_PGWU_PORT=0000:00:08.0 28 | #SGI_PORT=0000:00:09.0 29 | #S5S8_PGWU_IP=11.3.1.93 30 | #S5S8_PGWU_MAC=00:00:00:00:fe:00 31 | #SGI_IP=13.3.1.93 32 | #SGI_MAC=00:00:00:00:fe:01 33 | 34 | NUM_WORKER=1 35 | MEMORY=4096 36 | 37 | #Set 1 to enabled numa, otherwise set to 0 38 | NUMA=0 39 | 40 | #Give numa memory according to numa1 or numa0 socket 41 | NUMA0_MEMORY=$MEMORY 42 | NUMA1_MEMORY=0 43 | 44 | #set corelist here 45 | CORELIST="0-3" 46 | #Optional: 47 | #SGI_GW_IP=13.1.1.110 48 | #SGI_MASK=255.255.0.0 49 | 50 | #S1U_GW_IP=11.1.1.101 51 | #S1U_MASK=255.255.0.0 52 | -------------------------------------------------------------------------------- /ansible/roles/sgwu/templates/interface.j2: -------------------------------------------------------------------------------- 1 | ; Copyright (c) 2017 Intel Corporation 2 | ; 3 | ; Licensed under the Apache License, Version 2.0 (the "License"); 4 | ; you may not use this file except in compliance with the License. 5 | ; You may obtain a copy of the License at 6 | ; 7 | ; http://www.apache.org/licenses/LICENSE-2.0 8 | ; 9 | ; Unless required by applicable law or agreed to in writing, software 10 | ; distributed under the License is distributed on an "AS IS" BASIS, 11 | ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | ; See the License for the specific language governing permissions and 13 | ; limitations under the License. 14 | 15 | [0] 16 | ; please refer to INSTALL.MD for complete description of these parameters 17 | zmq_protocol = tcp 18 | 19 | ; zmq publisher and subscriber ip:port. To be configured to an available ip 20 | ; on the FPC Host. The port values are defined by the FPC Project. 21 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 22 | ; ng-core_cfg.mk 23 | zmq_sub_ip = {{ FPC_FPCSB_IP }} 24 | zmq_sub_port = 5560 25 | zmq_pub_ip = {{ FPC_FPCSB_IP }} 26 | zmq_pub_port = 5559 27 | 28 | ; CP and DP communication ip:port: Used for messages to communicate over ZMQ(PUSH/PULL) 29 | ; including table creation, table entries; and when DZMQ_COMM CFLAG is defined and 30 | ; DSDN_ODL_BUILD CFLAG is NOT defined, session establishment, modification, deletion, etc. 31 | ; Ex. CP: zmq_pull_port = 5556, zmq_push_port = 5559 32 | ; DP: zmq_pull_port = 5560, zmq_push_port = 5557 33 | zmq_cp_ip = {{ SGWC_FPCNB_IP }} 34 | zmq_pull_port = 5560 35 | zmq_push_port = 5557 36 | 37 | 38 | ; DP and CP communication ip:port: To be configured to available ip:ports on 39 | ; the DP and CP Hosts respectively. Used for messages to communicate over UDP 40 | ; including table creation, table entries; and when DSDN_ODL_BUILD CFLAG is NOT 41 | ; defined, session establishment, modification, deletion, etc. 42 | dp_comm_ip = {{ SGWU_FPCSB_IP }} 43 | dp_comm_port = 20 44 | cp_comm_ip = {{ SGWC_FPCNB_IP }} 45 | cp_comm_port = 21 46 | 47 | ; FPC ip:port: To be configured to an available IP of FPC host. The fpc_port 48 | ; is defined by the FPC project. 49 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 50 | ; ng-core_cfg.mk 51 | fpc_ip = {{ FPC_FPCSB_IP }} 52 | fpc_port = 8070 53 | fpc_topology_port = 8181 54 | 55 | ; The CP Northbound server ip:port: May be configured to any available ip:port 56 | ; on the CP Host. 57 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 58 | ; ng-core_cfg.mk 59 | cp_nb_ip = {{ SGWC_FPCNB_IP }} 60 | cp_nb_port = 9997 61 | 62 | ; DP and DealerIn communication ip and port to be configured to communicate 63 | ; with with DealerIn. Values of mrenclave, mrsigner and isvsvn required to 64 | ; verify DealerIn. Also values of DP certificate and private key path are 65 | ; required for DP verification by DealerIn.. 66 | {% if SGX_BUILD == 'true' %} 67 | dealer_in_ip = {{ SGX_DLRIN_SGX_DLRIN_IP }} 68 | dealer_in_port = {{ DL_IN_PORT }} 69 | dealer_in_mrenclave = {{ hostvars[groups['sgx-dealer-in'][0]]['DLIN_MRENCLAVE'] }} 70 | dealer_in_mrsigner = {{ hostvars[groups['sgx-dealer-in'][0]]['DLIN_MRSIGNER'] }} 71 | dealer_in_isvsvn = {{ ISVSVN }} 72 | {% else %} 73 | #dealer_in_ip = {{ SGX_DLRIN_SGX_DLRIN_IP }} 74 | dealer_in_port = {{ DL_IN_PORT }} 75 | dealer_in_mrenclave = 2d7738dc35924641d236b879f9473633765206d6ec2df0d519ae384d42b4fe27 76 | dealer_in_mrsigner = 63ef969cbc34ee465f277cd3c27e9b3c681d743e455f899daced1b3cf85ceb8f 77 | dealer_in_isvsvn = 0 78 | {% endif %} 79 | dp_cert_path = conf/cert.pem 80 | dp_pkey_path = conf/key.pem 81 | -------------------------------------------------------------------------------- /ansible/roles/sgwu/templates/ng-core_cfg.j2: -------------------------------------------------------------------------------- 1 | #SDN_ODL_BUILD flag is set for ODL builds, unset for direct UDP communication 2 | {% if WITH_FPC == 'yes' %} 3 | CFLAGS += -DSDN_ODL_BUILD 4 | 5 | #ZMQ_COMM flag is set for direct ZMQ communication, unset for direct UDP communication 6 | #CFLAGS += -DZMQ_COMM 7 | {% elif WITH_FPC == 'no' %} 8 | #CFLAGS += -DSDN_ODL_BUILD 9 | 10 | #ZMQ_COMM flag is set for direct ZMQ communication, unset for direct UDP communication 11 | CFLAGS += -DZMQ_COMM 12 | {% endif %} 13 | 14 | # ASR- Un-comment below line to shrink pipeline COREs used 15 | CFLAGS += -DNGCORE_SHRINK 16 | -------------------------------------------------------------------------------- /ansible/roles/sgwu/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | FLAG_DSTATIC_ARP: true 3 | FLAG_DPERF_TEST: true 4 | SGWU_LOG: /var/log/sgwu_install.log 5 | -------------------------------------------------------------------------------- /ansible/roles/sgx-dealer-in/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create sgx-dl-in directory 3 | file: 4 | path: "/opt/sgx-dl-in" 5 | state: directory 6 | mode: 0755 7 | 8 | - name: Create deps temp directory 9 | file: 10 | path: "{{ DEPS_DIR }}" 11 | state: directory 12 | mode: 0755 13 | register: dir_state 14 | 15 | - name: Git clone c3po repository 16 | git: 17 | repo: "{{ SGX_REPO }}" 18 | dest: "{{ REPO_DIR }}" 19 | version: "{{ SGX_COMMIT_ID }}" 20 | update: no 21 | 22 | - name: Copying scripts and config template 23 | template: 24 | src: "{{ item.src }}" 25 | dest: "{{ item.dest }}" 26 | mode: "{{ item.mode }}" 27 | with_items: 28 | - { src: 'deps_install.sh', dest: '{{ REPO_DIR }}/sgxcdr/dealer', mode: '0755' } 29 | - { src: 'dealer_install.sh', dest: '{{ REPO_DIR }}/sgxcdr/dealer', mode: '0755' } 30 | - { src: 'dealer_json.j2', dest: '{{ REPO_DIR }}/sgxcdr/dealer/conf/dealer.json', mode: '0644' } 31 | 32 | 33 | - name: Downloading all dependancy 34 | shell: "cd {{ REPO_DIR }}/sgxcdr/dealer && ./deps_install.sh |tee /var/log/sgx_dealer_deps_install.log" 35 | args: 36 | executable: /bin/bash 37 | when: dir_state.changed 38 | 39 | 40 | - name: Build dealer 41 | shell: "cd {{ REPO_DIR }}/sgxcdr/dealer && ./dealer_install.sh |tee /var/log/sgx_dealer_in_install.log" 42 | args: 43 | executable: /bin/bash 44 | 45 | - name: Generating dealer-in hash ( mrenclave and mrsigner ) 46 | shell: cd {{ REPO_DIR }}/sgxcdr/dealer && ./dealer -j conf/dealer.json -x | sed -n 's/MR.* ://p' 47 | register: hash_keys 48 | - set_fact: 49 | DLIN_MRENCLAVE: "{{ hash_keys.stdout_lines[0] }}" 50 | DLIN_MRSIGNER: "{{ hash_keys.stdout_lines[1] }}" 51 | - debug: 52 | msg: "sgx-dl-in: MRENCLAVE-{{ DLIN_MRENCLAVE }} MRSIGNER-{{ DLIN_MRSIGNER }}" 53 | 54 | # - name: start dlear-in 55 | # shell: cd {{ REPO_DIR }}/sgxcdr/dealer && ./dealer -m IN 56 | -------------------------------------------------------------------------------- /ansible/roles/sgx-dealer-in/templates/dealer_install.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | DEST_DIR="{{ DEPS_DIR }}" 3 | 4 | build_dealer_deps() 5 | { 6 | sudo apt-get -y install cmake 7 | cd $BASEDIR/deps 8 | 9 | #build mbedtls-SGX 10 | git clone https://github.com/bl4ck5un/mbedtls-SGX.git 11 | cp mbedtls_sgx_ra_*.patch mbedtls-SGX/ 12 | cd mbedtls-SGX 13 | git apply mbedtls_sgx_ra_prebuild.patch 14 | mkdir build 15 | cd build 16 | cmake .. 17 | make -j 18 | make install 19 | sleep 3 20 | cd ../ 21 | git apply mbedtls_sgx_ra_postbuild.patch 22 | 23 | #build sgx_tcdr 24 | cd ../sgx_zmq/sgx_tcdr/ 25 | make 26 | 27 | #build sgx_ucdr 28 | cd ../sgx_ucdr/ 29 | make 30 | 31 | #download rapidjson 32 | git submodule init 33 | git submodule update 34 | } 35 | 36 | build_dealer() 37 | { 38 | cd $BASEDIR 39 | make clean 40 | make SGX_MODE=HW SGX_DEBUG=1 41 | } 42 | 43 | 44 | get_dealer_hash() 45 | { 46 | output=($(./dealer -j conf/dealer.json -x | sed -n 's/MR.* ://p')) 47 | 48 | MRENCLAVE=${output[0]} 49 | MRSIGNER=${output[1]} 50 | } 51 | 52 | replace_kms_mrsigner() 53 | { 54 | #replace MRSIGNER value of KMS in Enclave/ca_bundle.h file 55 | sed -i "/#define KMS_MRSIGNER/c\#define KMS_MRSIGNER \"${MRSIGNER}\"" Enclave/ca_bundle.h 56 | } 57 | 58 | print_hash_message() 59 | { 60 | echo "---------------------------------------------------------------------------" 61 | echo "Use MRENCLAVE and MRSIGNER values while building KMS." 62 | echo "./install.sh " 63 | echo "MRENCLAVE : $MRENCLAVE" 64 | echo "MRSIGNER : $MRSIGNER" 65 | echo "---------------------------------------------------------------------------" 66 | } 67 | 68 | BASEDIR=$PWD 69 | 70 | build_dealer_deps 71 | build_dealer 72 | get_dealer_hash 73 | replace_kms_mrsigner 74 | build_dealer 75 | #get_dealer_hash 76 | #print_hash_message 77 | -------------------------------------------------------------------------------- /ansible/roles/sgx-dealer-in/templates/dealer_json.j2: -------------------------------------------------------------------------------- 1 | { 2 | "common": { 3 | "maxconnections": "16", 4 | "kmsserver": "{{ SGX_KMS_SGX_KMS_IP }}", 5 | "kmsport": "{{ KMS_PORT }}", 6 | "keynamespace": "{{KEY_NAME_SPACE}}" 7 | }, 8 | 9 | "dealer": { 10 | "runmode": "IN", 11 | "cdrhost": "{{ SGX_DLRRTR_SGX_DLRRTR_IP }}", 12 | "cdrport": "{{ CDR_IN_PORT }}", 13 | "port": "{{ DL_IN_PORT }}", 14 | "cdrpath": "./cdr", 15 | "cdrarchpath": "/tmp" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ansible/roles/sgx-dealer-in/templates/deps_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | DEST_DIR="{{ DEPS_DIR }}" 3 | install_intel_sgx() 4 | { 5 | #install Intel(R) SGX dependencies 6 | sudo apt-get -y update 7 | sudo apt-get -y install libssl-dev libcurl4-openssl-dev libprotobuf-dev build-essential 8 | 9 | #install Intel(R) SGX Driver 10 | wget https://download.01.org/intel-sgx/linux-1.9/sgx_linux_x64_driver_3abcf82.bin -P $DEST_DIR 11 | chmod +x $DEST_DIR/sgx_linux_x64_driver_3abcf82.bin 12 | sudo $DEST_DIR/sgx_linux_x64_driver_3abcf82.bin 13 | 14 | #install Intel(R) SGX Platform Software 15 | wget https://download.01.org/intel-sgx/linux-1.9/sgx_linux_ubuntu16.04.1_x64_psw_1.9.100.39124.bin -P $DEST_DIR 16 | chmod +x $DEST_DIR/sgx_linux_ubuntu16.04.1_x64_psw_1.9.100.39124.bin 17 | sudo $DEST_DIR/sgx_linux_ubuntu16.04.1_x64_psw_1.9.100.39124.bin 18 | 19 | #install Intel(R) SGX SDK 20 | wget https://download.01.org/intel-sgx/linux-1.9/sgx_linux_ubuntu16.04.1_x64_sdk_1.9.100.39124.bin -P $DEST_DIR 21 | chmod +x $DEST_DIR/sgx_linux_ubuntu16.04.1_x64_sdk_1.9.100.39124.bin 22 | sudo echo -e "no\n/opt/intel" |$DEST_DIR/sgx_linux_ubuntu16.04.1_x64_sdk_1.9.100.39124.bin 23 | 24 | source /opt/intel/sgxsdk/environment 25 | } 26 | 27 | install_zmq_lib() 28 | { 29 | #build and install ZeroMQ library 30 | sudo apt-get install -y libtool pkg-config autoconf automake uuid-dev 31 | 32 | wget https://github.com/zeromq/libzmq/releases/download/v4.2.0/zeromq-4.2.0.tar.gz -P $DEST_DIR 33 | cd $DEST_DIR 34 | tar xvzf zeromq-4.2.0.tar.gz 35 | cd zeromq-4.2.0 36 | ./configure 37 | make 38 | sudo make install 39 | ldconfig 40 | } 41 | 42 | install_deps() 43 | { 44 | install_intel_sgx 45 | install_zmq_lib 46 | } 47 | 48 | install_deps 49 | -------------------------------------------------------------------------------- /ansible/roles/sgx-dealer-in/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | REPO_DIR: "/opt/sgx-dl-in/c3po" 3 | -------------------------------------------------------------------------------- /ansible/roles/sgx-dealer-out/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create sgx-dl-in directory 3 | file: 4 | path: "/opt/sgx-dl-out" 5 | state: directory 6 | mode: 0755 7 | 8 | - name: Create deps temp directory 9 | file: 10 | path: "{{ DEPS_DIR }}" 11 | state: directory 12 | mode: 0755 13 | register: dir_state 14 | 15 | - name: Git clone c3po repository 16 | git: 17 | repo: "{{ SGX_REPO }}" 18 | dest: "{{ REPO_DIR }}" 19 | version: "{{ SGX_COMMIT_ID }}" 20 | update: no 21 | 22 | - name: Copying scripts and config template 23 | template: 24 | src: "{{ item.src }}" 25 | dest: "{{ item.dest }}" 26 | mode: "{{ item.mode }}" 27 | with_items: 28 | - { src: 'deps_install.sh', dest: '{{ REPO_DIR }}/sgxcdr/dealer', mode: '0755' } 29 | - { src: 'dealer_install.sh', dest: '{{ REPO_DIR }}/sgxcdr/dealer', mode: '0755' } 30 | - { src: 'dealer_json.j2', dest: '{{ REPO_DIR }}/sgxcdr/dealer/conf/dealer.json', mode: '0644' } 31 | 32 | - name: Downloading all dependancy 33 | shell: "cd {{ REPO_DIR }}/sgxcdr/dealer && ./deps_install.sh |tee /var/log/sgx_dealer_deps_install.log" 34 | args: 35 | executable: /bin/bash 36 | when: dir_state.changed 37 | 38 | - name: Build dealer-out 39 | shell: "cd {{ REPO_DIR }}/sgxcdr/dealer && ./dealer_install.sh |tee /var/log/sgx_dealer_out_install.log" 40 | args: 41 | executable: /bin/bash 42 | 43 | - name: Generate dealer-out hash ( mrenclave and mrsigner ) 44 | shell: cd {{ REPO_DIR }}/sgxcdr/dealer && ./dealer -j conf/dealer.json -x | sed -n 's/MR.* ://p' 45 | register: hash_keys 46 | - set_fact: 47 | DLOUT_MRENCLAVE: "{{ hash_keys.stdout_lines[0] }}" 48 | DLOUT_MRSIGNER: "{{ hash_keys.stdout_lines[1] }}" 49 | - debug: 50 | msg: "sgx-dl-out: MRENCLAVE- {{ DLOUT_MRENCLAVE }} MRSIGNER-{{ DLOUT_MRSIGNER }}" 51 | 52 | # - name: start dlear-in 53 | # shell: cd {{ REPO_DIR }}/sgxcdr/dealer && ./dealer -m OUT 54 | 55 | -------------------------------------------------------------------------------- /ansible/roles/sgx-dealer-out/templates/dealer.json: -------------------------------------------------------------------------------- 1 | { 2 | "common": { 3 | "maxconnections": "16", 4 | "kmsserver": "{{ SGX_KMS_SGX_KMS_IP }}", 5 | "kmsport": "{{ kmsport }}", 6 | "keynamespace": "{{ keynamespace }}" 7 | }, 8 | 9 | "dealer": { 10 | "runmode": "OUT", 11 | "cdrhost": "10.212.93.77", 12 | "cdrport": "{{ cdrport }}", 13 | "port": "{{ dl-in-port }}", 14 | "cdrpath": "./cdr", 15 | "cdrarchpath": "/tmp" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ansible/roles/sgx-dealer-out/templates/dealer_install.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | DEST_DIR="{{ DEPS_DIR }}" 3 | 4 | build_dealer_deps() 5 | { 6 | sudo apt-get -y install cmake 7 | cd $BASEDIR/deps 8 | 9 | #build mbedtls-SGX 10 | git clone https://github.com/bl4ck5un/mbedtls-SGX.git 11 | cp mbedtls_sgx_ra_*.patch mbedtls-SGX/ 12 | cd mbedtls-SGX 13 | git apply mbedtls_sgx_ra_prebuild.patch 14 | mkdir build 15 | cd build 16 | cmake .. 17 | make -j 18 | make install 19 | sleep 3 20 | cd ../ 21 | git apply mbedtls_sgx_ra_postbuild.patch 22 | 23 | #build sgx_tcdr 24 | cd ../sgx_zmq/sgx_tcdr/ 25 | make 26 | 27 | #build sgx_ucdr 28 | cd ../sgx_ucdr/ 29 | make 30 | 31 | #download rapidjson 32 | git submodule init 33 | git submodule update 34 | } 35 | 36 | build_dealer() 37 | { 38 | cd $BASEDIR 39 | make clean 40 | make SGX_MODE=HW SGX_DEBUG=1 41 | } 42 | 43 | 44 | get_dealer_hash() 45 | { 46 | output=($(./dealer -j conf/dealer.json -x | sed -n 's/MR.* ://p')) 47 | 48 | MRENCLAVE=${output[0]} 49 | MRSIGNER=${output[1]} 50 | } 51 | 52 | replace_kms_mrsigner() 53 | { 54 | #replace MRSIGNER value of KMS in Enclave/ca_bundle.h file 55 | sed -i "/#define KMS_MRSIGNER/c\#define KMS_MRSIGNER \"${MRSIGNER}\"" Enclave/ca_bundle.h 56 | } 57 | 58 | print_hash_message() 59 | { 60 | echo "---------------------------------------------------------------------------" 61 | echo "Use MRENCLAVE and MRSIGNER values while building KMS." 62 | echo "./install.sh " 63 | echo "MRENCLAVE : $MRENCLAVE" 64 | echo "MRSIGNER : $MRSIGNER" 65 | echo "---------------------------------------------------------------------------" 66 | } 67 | 68 | BASEDIR=$PWD 69 | 70 | build_dealer_deps 71 | build_dealer 72 | get_dealer_hash 73 | replace_kms_mrsigner 74 | build_dealer 75 | #get_dealer_hash 76 | #print_hash_message 77 | -------------------------------------------------------------------------------- /ansible/roles/sgx-dealer-out/templates/dealer_json.j2: -------------------------------------------------------------------------------- 1 | { 2 | "common": { 3 | "maxconnections": "16", 4 | "kmsserver": "{{ SGX_KMS_SGX_KMS_IP }}", 5 | "kmsport": "{{ KMS_PORT }}", 6 | "keynamespace": "{{KEY_NAME_SPACE}}" 7 | }, 8 | 9 | "dealer": { 10 | "runmode": "OUT", 11 | "cdrhost": "{{ SGX_DLRRTR_SGX_DLRRTR_IP }}", 12 | "cdrport": "{{ CDR_OUT_PORT }}", 13 | "port": "{{ DL_OUT_PORT }}", 14 | "cdrpath": "./cdr", 15 | "cdrarchpath": "/tmp" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ansible/roles/sgx-dealer-out/templates/deps_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | DEST_DIR="{{ DEPS_DIR }}" 3 | install_intel_sgx() 4 | { 5 | #install Intel(R) SGX dependencies 6 | sudo apt-get -y update 7 | sudo apt-get -y install libssl-dev libcurl4-openssl-dev libprotobuf-dev build-essential 8 | 9 | #install Intel(R) SGX Driver 10 | wget https://download.01.org/intel-sgx/linux-1.9/sgx_linux_x64_driver_3abcf82.bin -P $DEST_DIR 11 | chmod +x $DEST_DIR/sgx_linux_x64_driver_3abcf82.bin 12 | sudo $DEST_DIR/sgx_linux_x64_driver_3abcf82.bin 13 | 14 | #install Intel(R) SGX Platform Software 15 | wget https://download.01.org/intel-sgx/linux-1.9/sgx_linux_ubuntu16.04.1_x64_psw_1.9.100.39124.bin -P $DEST_DIR 16 | chmod +x $DEST_DIR/sgx_linux_ubuntu16.04.1_x64_psw_1.9.100.39124.bin 17 | sudo $DEST_DIR/sgx_linux_ubuntu16.04.1_x64_psw_1.9.100.39124.bin 18 | 19 | #install Intel(R) SGX SDK 20 | wget https://download.01.org/intel-sgx/linux-1.9/sgx_linux_ubuntu16.04.1_x64_sdk_1.9.100.39124.bin -P $DEST_DIR 21 | chmod +x $DEST_DIR/sgx_linux_ubuntu16.04.1_x64_sdk_1.9.100.39124.bin 22 | sudo echo -e "no\n/opt/intel" |$DEST_DIR/sgx_linux_ubuntu16.04.1_x64_sdk_1.9.100.39124.bin 23 | 24 | source /opt/intel/sgxsdk/environment 25 | } 26 | 27 | install_zmq_lib() 28 | { 29 | #build and install ZeroMQ library 30 | sudo apt-get install -y libtool pkg-config autoconf automake uuid-dev 31 | 32 | wget https://github.com/zeromq/libzmq/releases/download/v4.2.0/zeromq-4.2.0.tar.gz -P $DEST_DIR 33 | cd $DEST_DIR 34 | tar xvzf zeromq-4.2.0.tar.gz 35 | cd zeromq-4.2.0 36 | ./configure 37 | make 38 | sudo make install 39 | ldconfig 40 | } 41 | 42 | install_deps() 43 | { 44 | install_intel_sgx 45 | install_zmq_lib 46 | } 47 | 48 | install_deps 49 | -------------------------------------------------------------------------------- /ansible/roles/sgx-dealer-out/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | REPO_DIR: "/opt/sgx-dl-out/c3po" 3 | -------------------------------------------------------------------------------- /ansible/roles/sgx-kms/meta.bak/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Depends on sgx-dealer-in for generate MRENCLAVE and MRSIGNER dealer hash 3 | dependencies: 4 | - { role: sgx-dealer-in, hosts: sgx-dealer-in } 5 | -------------------------------------------------------------------------------- /ansible/roles/sgx-kms/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create sgx-dl-in dir 3 | file: 4 | path: "/opt/kms" 5 | state: directory 6 | mode: 0755 7 | 8 | - name: Create deps temp dir 9 | file: 10 | path: "{{ DEPS_DIR }}" 11 | state: directory 12 | mode: 0755 13 | register: dir_state 14 | 15 | - name: Git clone c3po repository 16 | git: 17 | repo: "{{ SGX_REPO }}" 18 | dest: "{{ REPO_DIR }}" 19 | version: "{{ SGX_COMMIT_ID }}" 20 | update: no 21 | 22 | - name: Copying scripts and config template 23 | template: 24 | src: "{{ item.src }}" 25 | dest: "{{ item.dest }}" 26 | mode: "{{ item.mode }}" 27 | with_items: 28 | - { src: 'deps_install.sh', dest: '{{ REPO_DIR }}/sgxcdr/kms', mode: '0755' } 29 | - { src: 'kms_install.sh', dest: '{{ REPO_DIR }}/sgxcdr/kms', mode: '0755' } 30 | - { src: 'kms_json.j2', dest: '{{ REPO_DIR }}/sgxcdr/kms/conf/kms.json', mode: '0644' } 31 | 32 | 33 | - name: Downloading all dependencies 34 | shell: "cd {{ REPO_DIR }}/sgxcdr/kms && ./deps_install.sh |tee {{ KMS_DEPS_LOG }}" 35 | args: 36 | executable: /bin/bash 37 | when: dir_state.changed 38 | 39 | - name: Build kms with sgx-dealer-in mrenclave and mrsigner 40 | shell: "cd {{ REPO_DIR }}/sgxcdr/kms && ./kms_install.sh {{ hostvars[groups['sgx-dealer-in'][0]]['DLIN_MRENCLAVE'] }} {{ hostvars[groups['sgx-dealer-in'][0]]['DLIN_MRSIGNER'] }} |tee {{ KMS_BUILD_LOG }}" 41 | args: 42 | executable: /bin/bash 43 | 44 | - name: Build kms with sgx-dealer-out mrenclave and mrsigner 45 | shell: "cd {{ REPO_DIR }}/sgxcdr/kms && ./kms_install.sh {{ hostvars[groups['sgx-dealer-out'][0]]['DLOUT_MRENCLAVE'] }} {{ hostvars[groups['sgx-dealer-out'][0]]['DLOUT_MRSIGNER'] }} |tee {{ KMS_BUILD_LOG }}" 46 | args: 47 | executable: /bin/bash 48 | - debug: 49 | msg: 50 | - "sgx-dealer-in: MRENCLAVE: {{ hostvars[groups['sgx-dealer-in'][0]]['DLIN_MRENCLAVE'] }} MRSIGNER: {{ hostvars[groups['sgx-dealer-in'][0]]['DLIN_MRSIGNER'] }}" 51 | - "sgx-dealer-out: MRENCLAVE: {{ hostvars[groups['sgx-dealer-out'][0]]['DLOUT_MRENCLAVE'] }} MRSIGNER: {{ hostvars[groups['sgx-dealer-out'][0]]['DLOUT_MRSIGNER'] }}" 52 | 53 | # - name: start kms 54 | # shell: "cd {{ REPO_DIR }}/sgxcdr/kms && ./kms -j conf/kms.json 55 | -------------------------------------------------------------------------------- /ansible/roles/sgx-kms/templates/deps_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | DEST_DIR="{{ DEPS_DIR }}" 3 | install_intel_sgx() 4 | { 5 | #install Intel(R) SGX dependencies 6 | sudo apt-get -y update 7 | sudo apt-get -y install libssl-dev libcurl4-openssl-dev libprotobuf-dev build-essential 8 | 9 | #install Intel(R) SGX Driver 10 | wget https://download.01.org/intel-sgx/linux-1.9/sgx_linux_x64_driver_3abcf82.bin -P $DEST_DIR 11 | chmod +x $DEST_DIR/sgx_linux_x64_driver_3abcf82.bin 12 | sudo $DEST_DIR/sgx_linux_x64_driver_3abcf82.bin 13 | 14 | #install Intel(R) SGX Platform Software 15 | wget https://download.01.org/intel-sgx/linux-1.9/sgx_linux_ubuntu16.04.1_x64_psw_1.9.100.39124.bin -P $DEST_DIR 16 | chmod +x $DEST_DIR/sgx_linux_ubuntu16.04.1_x64_psw_1.9.100.39124.bin 17 | sudo $DEST_DIR/sgx_linux_ubuntu16.04.1_x64_psw_1.9.100.39124.bin 18 | 19 | #install Intel(R) SGX SDK 20 | wget https://download.01.org/intel-sgx/linux-1.9/sgx_linux_ubuntu16.04.1_x64_sdk_1.9.100.39124.bin -P $DEST_DIR 21 | chmod +x $DEST_DIR/sgx_linux_ubuntu16.04.1_x64_sdk_1.9.100.39124.bin 22 | sudo echo -e "no\n/opt/intel" |$DEST_DIR/sgx_linux_ubuntu16.04.1_x64_sdk_1.9.100.39124.bin 23 | 24 | source /opt/intel/sgxsdk/environment 25 | } 26 | install_deps() 27 | { 28 | install_intel_sgx 29 | } 30 | 31 | install_deps 32 | -------------------------------------------------------------------------------- /ansible/roles/sgx-kms/templates/kms_install.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | DEST_DIR="{{ DEPS_DIR }}" 3 | 4 | build_kms_deps() 5 | { 6 | sudo apt-get install cmake 7 | 8 | cd $DEALERDIR/deps 9 | #build mbedtls-SGX 10 | git clone https://github.com/bl4ck5un/mbedtls-SGX.git 11 | cp mbedtls_sgx_ra_*.patch mbedtls-SGX/ 12 | cd mbedtls-SGX 13 | git apply mbedtls_sgx_ra_prebuild.patch 14 | mkdir build 15 | cd build 16 | cmake .. 17 | make -j 18 | make install 19 | sleep 3 20 | cd ../ 21 | git apply mbedtls_sgx_ra_postbuild.patch 22 | 23 | #download rapidjson 24 | git submodule init 25 | git submodule update 26 | } 27 | 28 | build_kms() 29 | { 30 | cd $BASEDIR 31 | make clean 32 | make SGX_MODE=HW SGX_DEBUG=1 33 | } 34 | 35 | 36 | replace_dealer_mrenclave_mrsigner() 37 | { 38 | cd $BASEDIR 39 | #replace MRENCLAVE value of Dealer in Enclave/ca_bundle.h file 40 | sed -i "0,/DEALER_MRENCLAVE/{s/DEALER_MRENCLAVE/${DEALER_MRENCLAVE}/}" Enclave/ca_bundle.h 41 | 42 | #replace MRSIGNER value of Dealer in Enclave/ca_bundle.h file 43 | sed -i "0,/DEALER_MRSIGNER/{s/DEALER_MRSIGNER/${DEALER_MRSIGNER}/}" Enclave/ca_bundle.h 44 | } 45 | 46 | BASEDIR=$PWD 47 | DEALERDIR=$BASEDIR/../dealer 48 | 49 | DEALER_MRENCLAVE=$1 50 | DEALER_MRSIGNER=$2 51 | 52 | build_kms_deps 53 | replace_dealer_mrenclave_mrsigner 54 | build_kms 55 | -------------------------------------------------------------------------------- /ansible/roles/sgx-kms/templates/kms_json.j2: -------------------------------------------------------------------------------- 1 | { 2 | "kms": { 3 | "storepath": "./store", 4 | "port": "{{ KMS_PORT }}", 5 | "maxconnections": "16" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /ansible/roles/sgx-kms/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | REPO_DIR: "/opt/sgx-kms/c3po" 3 | KMS_DEPS_LOG: "/var/log/sgx_kms_deps_install.log" 4 | KMS_BUILD_LOG: "/var/log/sgx_kms_install.log" 5 | -------------------------------------------------------------------------------- /ansible/roles/sgx-router/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create sgx-dl-in directory 3 | file: 4 | path: "/opt/sgx-router" 5 | state: directory 6 | mode: 0755 7 | 8 | - name: Git clone c3po repository 9 | git: 10 | repo: "{{ SGX_REPO }}" 11 | dest: "{{ REPO_DIR }}" 12 | version: "{{ SGX_COMMIT_ID }}" 13 | update: no 14 | 15 | - name: Installing python and python-pip packages 16 | apt: 17 | name: "{{ item }}" 18 | state: present 19 | with_items: 20 | - python2.7 21 | - python-pip 22 | 23 | - name: Installing pyzmq package 24 | pip: 25 | name: pyzmq 26 | version: 17.0.0 27 | executable: pip2 28 | -------------------------------------------------------------------------------- /ansible/roles/sgx-router/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | REPO_DIR: "/opt/sgx-router/c3po" 3 | -------------------------------------------------------------------------------- /ansible/roles/sgx_host_pre/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: add ubuntu user 3 | user: 4 | name: ubuntu 5 | state: present 6 | home: "/home/ubuntu" 7 | 8 | - name: add authorized key 9 | authorized_key: 10 | user: ubuntu 11 | state: present 12 | key: "{{ lookup('file', '/home/ubuntu/.ssh/id_rsa.pub') }}" 13 | 14 | - name: add ubuntu user into sudoers file 15 | lineinfile: 16 | dest: "/etc/sudoers" 17 | state: present 18 | regexp: "ubuntu" 19 | line: "ubuntu ALL=(ALL:ALL) NOPASSWD:ALL" 20 | -------------------------------------------------------------------------------- /ansible/roles/spgwc/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Git clone for NGIC-RTC 3 | git: 4 | repo: "{{ NGIC_REPO }}" 5 | dest: "{{ NGIC_REPO_DIR }}" 6 | version: "{{ NGIC_COMMIT_ID }}" 7 | update: no 8 | 9 | - name: copying build script 10 | copy: 11 | src: build.sh 12 | dest: "{{ NGIC_REPO_DIR }}/" 13 | owner: "root" 14 | mode: "0755" 15 | 16 | - name: copying sgwc configuration files 17 | template: 18 | src: "{{ item.src }}" 19 | dest: "{{ item.dest }}" 20 | backup: yes 21 | with_items: 22 | - { src: 'cp_config.j2', dest: '/{{ NGIC_REPO_DIR }}/config/cp_config.cfg' } 23 | - { src: 'interface.j2', dest: '/{{ NGIC_REPO_DIR }}/config/interface.cfg' } 24 | # - { src: 'ng-core_cfg.j2', dest: '{{ NGIC_REPO_DIR }}/config/ng-core_cfg.mk' } 25 | # - { src: 'run_spgwc.j2', dest: '{{ SERVICE_SCRIPT_PATH }}' } 26 | # - { src: 'spgwc.service.j2', dest: '/etc/systemd/system/spgwc.service' } 27 | 28 | # - name: systemctl daemon-reload and set permission spgwc service 29 | # shell: chmod +x {{ SERVICE_SCRIPT_PATH }} && systemctl daemon-reload 30 | # args: 31 | # executable: /bin/bash 32 | 33 | - name: Run the installation script 34 | shell: cd {{ NGIC_REPO_DIR }} && ./build.sh cp |tee {{ SPGWC_LOG }} 35 | args: 36 | executable: /bin/bash 37 | 38 | # - name: staring dp service 39 | # service: 40 | # name: spgwc 41 | # state: started 42 | -------------------------------------------------------------------------------- /ansible/roles/spgwc/templates/cp_config.j2: -------------------------------------------------------------------------------- 1 | NOW=$(date +"%Y-%m-%d_%H-%M") 2 | FILE="logs/cp_$NOW.log" 3 | #SPGW_CFG:: SGWC=01; PGWC=02; SPGWC=03 4 | SPGW_CFG=03 5 | S11_MME_IP={{ MME_S11_IP }} 6 | S11_SGW_IP={{ SPGWC_S11_IP }} 7 | S1U_SGW_IP={{ SPGWU_S1U_IP }} 8 | S5S8_SGWU_IP=1.1.1.1 9 | S5S8_PGWU_IP=2.2.2.2 10 | S5S8_SGWC_IP=3.3.3.3 11 | S5S8_PGWC_IP=4.4.4.4 12 | IP_POOL_IP=16.0.0.0 13 | IP_POOL_MASK=255.0.0.0 14 | APN=apn1 15 | #APN=n.ispsn,otasn 16 | MEMORY=1024 17 | #Below parameters are for Socket memory for perticular numa socket 18 | NUMA0_MEMORY=$MEMORY 19 | NUMA1_MEMORY=0 20 | 21 | CORELIST="0-4" 22 | -------------------------------------------------------------------------------- /ansible/roles/spgwc/templates/interface.j2: -------------------------------------------------------------------------------- 1 | ; Copyright (c) 2017 Intel Corporation 2 | ; 3 | ; Licensed under the Apache License, Version 2.0 (the "License"); 4 | ; you may not use this file except in compliance with the License. 5 | ; You may obtain a copy of the License at 6 | ; 7 | ; http://www.apache.org/licenses/LICENSE-2.0 8 | ; 9 | ; Unless required by applicable law or agreed to in writing, software 10 | ; distributed under the License is distributed on an "AS IS" BASIS, 11 | ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | ; See the License for the specific language governing permissions and 13 | ; limitations under the License. 14 | 15 | [0] 16 | ; please refer to INSTALL.MD for complete description of these parameters 17 | zmq_protocol = tcp 18 | 19 | ; zmq publisher and subscriber ip:port. To be configured to an available ip 20 | ; on the FPC Host. The port values are defined by the FPC Project. 21 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 22 | ; ng-core_cfg.mk 23 | zmq_sub_ip = {{ FPC_FPCSB_IP }} 24 | zmq_sub_port = 5560 25 | zmq_pub_ip = {{ FPC_FPCSB_IP }} 26 | zmq_pub_port = 5559 27 | 28 | ; CP and DP communication ip:port: Used for messages to communicate over ZMQ(PUSH/PULL) 29 | ; including table creation, table entries; and when DZMQ_COMM CFLAG is defined and 30 | ; DSDN_ODL_BUILD CFLAG is NOT defined, session establishment, modification, deletion, etc. 31 | ; Ex. CP: zmq_pull_port = 5556, zmq_push_port = 5559 32 | ; DP: zmq_pull_port = 5560, zmq_push_port = 5557 33 | zmq_cp_ip = {{ SPGWC_FPCNB_IP }} 34 | zmq_pull_port = 5560 35 | zmq_push_port = 5557 36 | 37 | ; DP and CP communication ip:port: To be configured to available ip:ports on 38 | ; the DP and CP Hosts respectively. Used for messages to communicate over UDP 39 | ; including table creation, table entries; and when DSDN_ODL_BUILD CFLAG is NOT 40 | ; defined, session establishment, modification, deletion, etc. 41 | dp_comm_ip = {{ SPGWU_FPCSB_IP }} 42 | dp_comm_port = 20 43 | cp_comm_ip = {{ SPGWC_FPCNB_IP }} 44 | cp_comm_port = 21 45 | 46 | ; FPC ip:port: To be configured to an available IP of FPC host. The fpc_port 47 | ; is defined by the FPC project. 48 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 49 | ; ng-core_cfg.mk 50 | fpc_ip = {{ FPC_FPCNB_IP }} 51 | fpc_port = 8070 52 | fpc_topology_port = 8181 53 | 54 | ; The CP Northbound server ip:port: May be configured to any available ip:port 55 | ; on the CP Host. 56 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 57 | ; ng-core_cfg.mk 58 | cp_nb_ip = {{ SPGWC_FPCNB_IP }} 59 | cp_nb_port = 9997 60 | 61 | ; DP and DealerIn communication ip and port to be configured to communicate 62 | ; with with DealerIn. Values of mrenclave, mrsigner and isvsvn required to 63 | ; verify DealerIn. Also values of DP certificate and private key path are 64 | ; required for DP verification by DealerIn.. 65 | #dealer_in_ip = {{ DEALER_IN_IP }} 66 | dealer_in_port = 443 67 | 68 | dealer_in_mrenclave = 2d7738dc35924641d236b879f9473633765206d6ec2df0d519ae384d42b4fe27 69 | dealer_in_mrsigner = 63ef969cbc34ee465f277cd3c27e9b3c681d743e455f899daced1b3cf85ceb8f 70 | dealer_in_isvsvn = 0 71 | 72 | dp_cert_path = conf/cert.pem 73 | dp_pkey_path = conf/key.pem 74 | 75 | -------------------------------------------------------------------------------- /ansible/roles/spgwc/templates/ng-core_cfg.j2: -------------------------------------------------------------------------------- 1 | #SDN_ODL_BUILD flag is set for ODL builds, unset for direct UDP communication 2 | {% if WITH_FPC == 'yes' %} 3 | CFLAGS += -DSDN_ODL_BUILD 4 | 5 | #ZMQ_COMM flag is set for direct ZMQ communication, unset for direct UDP communication 6 | #CFLAGS += -DZMQ_COMM 7 | {% elif WITH_FPC == 'no' %} 8 | #CFLAGS += -DSDN_ODL_BUILD 9 | 10 | #ZMQ_COMM flag is set for direct ZMQ communication, unset for direct UDP communication 11 | CFLAGS += -DZMQ_COMM 12 | {% endif %} 13 | 14 | # ASR- Un-comment below line to shrink pipeline COREs used 15 | CFLAGS += -DNGCORE_SHRINK 16 | -------------------------------------------------------------------------------- /ansible/roles/spgwc/templates/spgwc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ### BEGIN INIT INFO 3 | # Provides: 4 | # Required-Start: $local_fs $network $named $time $syslog 5 | # Required-Stop: $local_fs $network $named $time $syslog 6 | # Default-Start: 2 3 4 5 7 | # Default-Stop: 0 1 6 8 | # Description: 9 | ### END INIT INFO 10 | 11 | SCRIPT=/tmp/ngic-rtc/cp/run.sh 12 | RUNAS=root 13 | 14 | PIDFILE=/var/run/spgwc.pid 15 | LOGFILE=/var/log/spgwc.log 16 | 17 | start() { 18 | if [ -f /var/run/$PIDNAME ] && kill -0 $(cat /var/run/$PIDNAME); then 19 | echo 'Service already running' >&2 20 | return 1 21 | fi 22 | echo 'Starting service…' >&2 23 | local CMD="$SCRIPT &> \"$LOGFILE\" & echo \$!" 24 | su -c "$CMD" $RUNAS > "$PIDFILE" 25 | echo 'Service started' >&2 26 | } 27 | 28 | stop() { 29 | if [ ! -f "$PIDFILE" ] || ! kill -0 $(cat "$PIDFILE"); then 30 | echo 'Service not running' >&2 31 | return 1 32 | fi 33 | echo 'Stopping service…' >&2 34 | kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE" 35 | echo 'Service stopped' >&2 36 | } 37 | 38 | case "$1" in 39 | start) 40 | start 41 | ;; 42 | stop) 43 | stop 44 | ;; 45 | retart) 46 | stop 47 | start 48 | ;; 49 | *) 50 | echo "Usage: $0 {start|stop|restart}" 51 | esac 52 | -------------------------------------------------------------------------------- /ansible/roles/spgwc/templates/spgwc.service.j2: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description= spgwc service 3 | 4 | [Service] 5 | ExecStart={{ SERVICE_SCRIPT_PATH }} 6 | 7 | [Install] 8 | WantedBy=default.target 9 | -------------------------------------------------------------------------------- /ansible/roles/spgwc/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | SERVICE_SCRIPT_PATH: '{{ NGIC_REPO_DIR }}/cp/run.sh' 3 | SPGWC_LOG: /var/log/spgwc_install.log 4 | DEALER_IN_IP: 10.212.93.78 5 | -------------------------------------------------------------------------------- /ansible/roles/spgwu/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - setup: 3 | register: host_facts 4 | - set_fact: 5 | temp_var: "{{ ansible_interfaces|sort }}" 6 | - set_fact: 7 | S1U_DEV: "ansible_{{ temp_var[2] }}" 8 | SGI_DEV: "ansible_{{ temp_var[3] }}" 9 | - set_fact: 10 | S1U_PCIID: "{{ host_facts.ansible_facts[S1U_DEV].pciid }}" 11 | S1U_MAC: "{{ host_facts.ansible_facts[S1U_DEV].macaddress }}" 12 | SGI_PCIID: "{{ host_facts.ansible_facts[SGI_DEV].pciid }}" 13 | SGI_MAC: "{{ host_facts.ansible_facts[SGI_DEV].macaddress }}" 14 | - debug: 15 | msg: 16 | - "S1U = {{ S1U_DEV }} - {{ S1U_PCIID }} - {{ S1U_MAC }}" 17 | - "SGI = {{ SGI_DEV }} - {{ SGI_PCIID }} - {{ SGI_MAC }}" 18 | 19 | - name: Git clone for NGIC-RTC 20 | git: 21 | repo: "{{ NGIC_REPO }}" 22 | dest: "{{ NGIC_REPO_DIR }}" 23 | version: "{{ NGIC_COMMIT_ID }}" 24 | update: no 25 | 26 | - name: Installing libs 27 | apt: 28 | name: "{{ item }}" 29 | state: present 30 | with_items: 31 | - curl 32 | - build-essential 33 | - linux-headers-{{ ansible_kernel }} 34 | - unzip 35 | - libpcap0.8-dev 36 | - gcc 37 | - libjson0-dev 38 | - make 39 | - libc6 40 | - libc6-dev 41 | - g++-multilib 42 | - libzmq3-dev 43 | - libcurl4-openssl-dev 44 | - libssl-dev 45 | - cmake 46 | 47 | - name: copying ansible install spgwu build script 48 | template: 49 | src: build.j2 50 | dest: "{{ NGIC_REPO_DIR }}/build.sh" 51 | owner: "root" 52 | mode: "0755" 53 | 54 | - name: copying spgwu configuration files 55 | template: 56 | src: "{{ item.src }}" 57 | dest: "{{ item.dest }}" 58 | backup: yes 59 | with_items: 60 | - { src: 'dp_config.j2', dest: '/{{ NGIC_REPO_DIR }}/config/dp_config.cfg' } 61 | - { src: 'interface.j2', dest: '/{{ NGIC_REPO_DIR }}/config/interface.cfg' } 62 | # - { src: 'ng-core_cfg.j2', dest: '{{ NGIC_REPO_DIR }}/config/ng-core_cfg.mk' } 63 | # - { src: 'Makefile1.j2', dest: '{{ NGIC_REPO_DIR }}/dp/Makefile' } 64 | 65 | - name: Run the installation script 66 | shell: cd {{ NGIC_REPO_DIR }} && ./build.sh dp |tee {{ SPGWU_LOG }} 67 | args: 68 | executable: /bin/bash 69 | 70 | - name: DPDK Binding for S1U and SGI Interface 71 | shell: python {{ NGIC_REPO_DIR }}/dpdk/usertools/dpdk-devbind.py -b igb_uio {{ S1U_PCIID }} {{ SGI_PCIID }} 72 | register: result 73 | - debug: 74 | var: result 75 | 76 | -------------------------------------------------------------------------------- /ansible/roles/spgwu/templates/Makefile.j2: -------------------------------------------------------------------------------- 1 | ifeq ($(RTE_SDK),) 2 | $(error "Please define RTE_SDK environment variable") 3 | endif 4 | MAKEFLAGS += -j 5 | RTE_TARGET ?= x86_64-native-linuxapp-gcc 6 | include $(RTE_SDK)/mk/rte.vars.mk 7 | include $(NG_CORE)/config/ng-core_cfg.mk 8 | APP = ngic_dataplane 9 | SRCS-y := main.c\ 10 | pkt_handler.c\ 11 | cdr.c\ 12 | master_cdr.c\ 13 | session_cdr.c\ 14 | config.c\ 15 | init.c\ 16 | dataplane.c\ 17 | gtpu.c\ 18 | ether.c\ 19 | ipv4.c\ 20 | util.c\ 21 | acl.c\ 22 | meter.c\ 23 | adc_table.c\ 24 | pcc_table.c\ 25 | sess_table.c\ 26 | commands.c\ 27 | stats.c\ 28 | ddn_utils.c\ 29 | extended_cdr.c\ 30 | timer_stats.c\ 31 | kni_pkt_handler.c\ 32 | gtpu_echo.c\ 33 | pipeline/epc_packet_framework.o\ 34 | pipeline/epc_arp.o\ 35 | pipeline/epc_spns_dns.o\ 36 | $(SRCDIR)/../interface/interface.o\ 37 | $(SRCDIR)/../cp_dp_api/vepc_cp_dp_api.o\ 38 | $(SRCDIR)/../test/simu_cp/nsb/nsb_test_util.o\ 39 | $(SRCDIR)/../test/simu_cp/simu_cp.o\ 40 | $(SRCDIR)/../test/simu_cp/pkt_filtrs.o\ 41 | $(SRCDIR)/../interface/ipc/dp_ipc_api.o\ 42 | $(SRCDIR)/../interface/udp/vepc_udp.o\ 43 | CFLAGS += -I$(SRCDIR)/ 44 | CFLAGS += -I$(SRCDIR)/../interface 45 | CFLAGS += -I$(SRCDIR)/../interface/ipc 46 | CFLAGS += -I$(SRCDIR)/../interface/udp 47 | CFLAGS += -I$(SRCDIR)/../interface/sdn 48 | CFLAGS += -I$(SRCDIR)/../interface/zmq 49 | CFLAGS += -I$(SRCDIR)/../cp_dp_api 50 | CFLAGS += -I$(SRCDIR)/../test/simu_cp 51 | CFLAGS += -I$(SRCDIR)/../test/simu_cp/nsb 52 | CFLAGS += -I$(SRCDIR)/pipeline 53 | CFLAGS += -I$(SRCDIR)/../cp 54 | CFLAGS += -I$(SRCDIR)/../lib/libsponsdn 55 | CFLAGS += -Wno-psabi # suppress "The ABI for passing parameters with 64-byte alignment has changed in GCC 4.6" 56 | CFLAGS += -DLDB_DP # should be included for dataplane. 57 | ifneq (,$(findstring NGCORE_SHRINK, $(CFLAGS))) 58 | SRCS-y += pipeline/epc_ul.o 59 | SRCS-y += pipeline/epc_dl.o 60 | else 61 | SRCS-y += pipeline/epc_rx.o\ 62 | pipeline/epc_tx.o\ 63 | pipeline/epc_load_balance.o\ 64 | pipeline/epc_worker.o 65 | endif 66 | ifneq (,$(findstring SDN_ODL_BUILD, $(CFLAGS))) 67 | SRCS-y += $(SRCDIR)/../interface/zmq/zmqsub.o 68 | SRCS-y += $(SRCDIR)/../interface/zmq/zmqpub.o 69 | LDFLAGS += -L/usr/local/lib -lzmq 70 | endif 71 | ifeq ($(SGX_BUILD), 1) 72 | SRCS-y += ssl_client.c 73 | CFLAGS += -DSGX_CDR 74 | CFLAGS += -I$(NG_CORE)/linux-sgx/common/inc 75 | LDFLAGS += -lssl 76 | endif 77 | CFLAGS += -O3 78 | {% if FLAG_DSTATIC_ARP == true %} 79 | CFLAGS += -DSTATIC_ARP 80 | {% else %} 81 | #CFLAGS += -DSTATIC_ARP 82 | {% endif %} 83 | ifneq (,$(findstring SIMU_CP, $(CFLAGS))) 84 | SRCS-y += $(SRCDIR)/../cp/cp_stats.o 85 | endif 86 | CFLAGS += -DSTATS 87 | CFLAGS += -DDP_TABLE_CONFIG 88 | {% if FLAG_DPERF_TEST == true %} 89 | CFLAGS += -DPERF_TEST 90 | {% else %} 91 | #CFLAGS += -DPERF_TEST 92 | {% endif %} 93 | CFLAGS += -Werror 94 | CFLAGS += -Wunused-variable 95 | CFLAGS_config.o := -D_GNU_SOURCE 96 | ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) 97 | CFLAGS_dataplane.o += -Wno-return-type 98 | endif 99 | LDFLAGS += -L$(RTE_SRCDIR)/../lib/libsponsdn/x86_64-native-linuxapp-gcc/ -lsponsdn 100 | LDFLAGS += -L$(HYPERSCANDIR)/build/lib 101 | LDFLAGS += -lexpressionutil -lhs -lhs_runtime -lstdc++ -lm -lcrypto 102 | LDFLAGS += -lrte_pmd_af_packet 103 | LDFLAGS += -lpcap 104 | include $(RTE_SDK)/mk/rte.extapp.mk 105 | -------------------------------------------------------------------------------- /ansible/roles/spgwu/templates/dp_config.j2: -------------------------------------------------------------------------------- 1 | NOW=$(date +"%Y-%m-%d_%H-%M") 2 | FILE="logs/dp_$NOW.log" 3 | #######[KNI-INTERFACE-NAMES]####### 4 | ##S1U INTERFACE## 5 | UL_IFACE="S1Udev" 6 | ##SGI INTERFACE## 7 | DL_IFACE="SGIdev" 8 | #dp configure parameter selections 9 | #SPGW_CFG:: SGWU=01; PGWU=02; SPGWU=03 10 | # 11 | #Example configurations as per selected SPGW_CFG is given below. 12 | #Uncomment the section of parameters based on PGW_CFG configuration: 13 | # 14 | #####[SGWU]##### 15 | #SPGW_CFG=01 16 | #S1U_PORT=0000:00:05.0 17 | #S5S8_SGWU_PORT=0000:00:06.0 18 | #S1U_IP=11.1.1.93 19 | #S1U_MAC=ea:c3:4f:bf:ac:a6 20 | #S5S8_SGWU_IP=12.1.1.93 21 | #S5S8_SGWU_MAC=c2:9c:ff:7c:2a:38 22 | 23 | #####[PGWU]##### 24 | #SPGW_CFG=02 25 | #S5S8_PGWU_PORT=0000:00:08.0 26 | #SGI_PORT=0000:00:09.0 27 | #S5S8_PGWU_IP=11.3.1.93 28 | #S5S8_PGWU_MAC=00:00:00:00:fe:00 29 | #SGI_IP=13.3.1.93 30 | #SGI_MAC=00:00:00:00:fe:01 31 | 32 | 33 | #####[SPGWU]##### 34 | SPGW_CFG=03 35 | S1U_PORT={{ S1U_PCIID }} 36 | SGI_PORT={{ SGI_PCIID }} 37 | S1U_IP={{ SPGWU_S1U_IP }} 38 | S1U_MAC={{ S1U_MAC }} 39 | SGI_IP={{ SPGWU_SGI_IP }} 40 | SGI_MAC={{ SGI_MAC }} 41 | S1U_MASK=255.255.255.0 42 | SGI_MASK=255.255.255.0 43 | 44 | NUM_WORKER=1 45 | MEMORY=4096 46 | 47 | #Set 1 to enabled numa, otherwise set to 0 48 | NUMA=0 49 | 50 | #Give numa memory according to numa1 or numa0 socket 51 | NUMA0_MEMORY=4096 52 | NUMA1_MEMORY=0 53 | 54 | #set coremask here 55 | CORELIST="0-3" 56 | #Optional: 57 | #SGI_GW_IP=13.1.1.110 58 | #SGI_MASK=255.255.0.0 59 | 60 | #S1U_GW_IP=11.1.1.101 61 | #S1U_MASK=255.255.0.0 62 | -------------------------------------------------------------------------------- /ansible/roles/spgwu/templates/interface.j2: -------------------------------------------------------------------------------- 1 | ; Copyright (c) 2017 Intel Corporation 2 | ; 3 | ; Licensed under the Apache License, Version 2.0 (the "License"); 4 | ; you may not use this file except in compliance with the License. 5 | ; You may obtain a copy of the License at 6 | ; 7 | ; http://www.apache.org/licenses/LICENSE-2.0 8 | ; 9 | ; Unless required by applicable law or agreed to in writing, software 10 | ; distributed under the License is distributed on an "AS IS" BASIS, 11 | ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | ; See the License for the specific language governing permissions and 13 | ; limitations under the License. 14 | 15 | [0] 16 | ; please refer to INSTALL.MD for complete description of these parameters 17 | zmq_protocol = tcp 18 | 19 | ; zmq publisher and subscriber ip:port. To be configured to an available ip 20 | ; on the FPC Host. The port values are defined by the FPC Project. 21 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 22 | ; ng-core_cfg.mk 23 | zmq_sub_ip = {{ FPC_FPCSB_IP }} 24 | zmq_sub_port = 5560 25 | zmq_pub_ip = {{ FPC_FPCSB_IP }} 26 | zmq_pub_port = 5559 27 | 28 | ; CP and DP communication ip:port: Used for messages to communicate over ZMQ(PUSH/PULL) 29 | ; including table creation, table entries; and when DZMQ_COMM CFLAG is defined and 30 | ; DSDN_ODL_BUILD CFLAG is NOT defined, session establishment, modification, deletion, etc. 31 | ; Ex. CP: zmq_pull_port = 5556, zmq_push_port = 5559 32 | ; DP: zmq_pull_port = 5560, zmq_push_port = 5557 33 | zmq_cp_ip = {{ SPGWC_FPCNB_IP }} 34 | zmq_pull_port = 5560 35 | zmq_push_port = 5557 36 | 37 | 38 | ; DP and CP communication ip:port: To be configured to available ip:ports on 39 | ; the DP and CP Hosts respectively. Used for messages to communicate over UDP 40 | ; including table creation, table entries; and when DSDN_ODL_BUILD CFLAG is NOT 41 | ; defined, session establishment, modification, deletion, etc. 42 | dp_comm_ip = {{ SPGWU_FPCSB_IP }} 43 | dp_comm_port = 20 44 | cp_comm_ip = {{ SPGWC_FPCNB_IP }} 45 | cp_comm_port = 21 46 | 47 | ; FPC ip:port: To be configured to an available IP of FPC host. The fpc_port 48 | ; is defined by the FPC project. 49 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 50 | ; ng-core_cfg.mk 51 | fpc_ip = {{ FPC_FPCSB_IP }} 52 | fpc_port = 8070 53 | fpc_topology_port = 8181 54 | 55 | ; The CP Northbound server ip:port: May be configured to any available ip:port 56 | ; on the CP Host. 57 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 58 | ; ng-core_cfg.mk 59 | cp_nb_ip = {{ SPGWC_FPCNB_IP }} 60 | cp_nb_port = 9997 61 | 62 | ; DP and DealerIn communication ip and port to be configured to communicate 63 | ; with with DealerIn. Values of mrenclave, mrsigner and isvsvn required to 64 | ; verify DealerIn. Also values of DP certificate and private key path are 65 | ; required for DP verification by DealerIn.. 66 | {% if SGX_BUILD == 'true' %} 67 | dealer_in_ip = {{ SGX_DLRIN_SGX_DLRIN_IP }} 68 | dealer_in_port = {{ DL_IN_PORT }} 69 | dealer_in_mrenclave = {{ hostvars[groups['sgx-dealer-in'][0]]['DLIN_MRENCLAVE'] }} 70 | dealer_in_mrsigner = {{ hostvars[groups['sgx-dealer-in'][0]]['DLIN_MRSIGNER'] }} 71 | dealer_in_isvsvn = {{ ISVSVN }} 72 | {% else %} 73 | #dealer_in_ip = {{ SGX_DLRIN_SGX_DLRIN_IP }} 74 | dealer_in_port = {{ DL_IN_PORT }} 75 | dealer_in_mrenclave = 2d7738dc35924641d236b879f9473633765206d6ec2df0d519ae384d42b4fe27 76 | dealer_in_mrsigner = 63ef969cbc34ee465f277cd3c27e9b3c681d743e455f899daced1b3cf85ceb8f 77 | dealer_in_isvsvn = 0 78 | {% endif %} 79 | 80 | dp_cert_path = conf/cert.pem 81 | dp_pkey_path = conf/key.pem 82 | 83 | -------------------------------------------------------------------------------- /ansible/roles/spgwu/templates/ng-core_cfg.j2: -------------------------------------------------------------------------------- 1 | #SDN_ODL_BUILD flag is set for ODL builds, unset for direct UDP communication 2 | {% if WITH_FPC == 'yes' %} 3 | CFLAGS += -DSDN_ODL_BUILD 4 | 5 | #ZMQ_COMM flag is set for direct ZMQ communication, unset for direct UDP communication 6 | #CFLAGS += -DZMQ_COMM 7 | {% elif WITH_FPC == 'no' %} 8 | #CFLAGS += -DSDN_ODL_BUILD 9 | 10 | #ZMQ_COMM flag is set for direct ZMQ communication, unset for direct UDP communication 11 | CFLAGS += -DZMQ_COMM 12 | {% endif %} 13 | 14 | # ASR- Un-comment below line to shrink pipeline COREs used 15 | CFLAGS += -DNGCORE_SHRINK 16 | -------------------------------------------------------------------------------- /ansible/roles/spgwu/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | FLAG_DSTATIC_ARP: true 3 | FLAG_DPERF_TEST: true 4 | SPGWU_LOG: /var/log/spgwu_install.log 5 | -------------------------------------------------------------------------------- /ansible/roles/terraform_setup/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Git clone for vEPC terraform scripts 3 | git: 4 | repo: "{{ TR_REPO }}" 5 | dest: "{{ TR_REPO_DIR }}" 6 | version: master 7 | update: no 8 | 9 | - name: Copy input.cfg 10 | copy: 11 | src: "{{ item }}" 12 | dest: "{{ TR_REPO_DIR }}" 13 | owner: root 14 | group: root 15 | mode: 0644 16 | with_items: 17 | - "../../c3po_ngic_input.cfg" 18 | 19 | - name: Copy sgx yml file 20 | copy: 21 | src: "{{ item }}" 22 | dest: "{{ TR_REPO_DIR }}/ansible/group_vars" 23 | owner: root 24 | group: root 25 | mode: 0644 26 | with_items: 27 | - "../../ansible/group_vars/sgx.yml" 28 | - "../../ansible/group_vars/c3po.yml" 29 | - "../../ansible/group_vars/repo.yml" 30 | - "../../ansible/group_vars/prephost.yml" 31 | 32 | - name: copy sgx_inv file on DP hosts 33 | copy: 34 | src: "{{ TR_REPO_DIR }}/ansible/sgx_inv" 35 | dest: "{{ TR_REPO_DIR }}/ansible" 36 | when: HOST_TYPE == "spgw" or HOST_TYPE == "dp" 37 | 38 | - name: get prerequisite 39 | shell : "cd {{ TR_REPO_DIR }}/scripts && ./prerequisite.sh" 40 | args: 41 | executable: /bin/bash 42 | 43 | - name: host validation 44 | shell : "cd {{ TR_REPO_DIR }}/terraform/scripts && ./host_validation.sh" 45 | args: 46 | executable: /bin/bash 47 | 48 | - name: Generate device script for control plane 49 | shell : "cd {{ TR_REPO_DIR }}/terraform/scripts && ./network_creation.sh {{ HOST_TYPE }}" 50 | args: 51 | executable: /bin/bash 52 | 53 | - name: prepare sgx host from DP host 54 | shell: "cd {{ TR_REPO_DIR }}/ansible && /usr/bin/ansible-playbook -i sgx_inv sgx_host_pre.yml -u ubuntu -e 'ansible_python_interpreter=/usr/bin/python3'" 55 | args: 56 | executable: /bin/bash 57 | when: HOST_TYPE == "spgw" or HOST_TYPE == "dp" 58 | 59 | - name: Deploy 60 | shell : "cd {{ TR_REPO_DIR }} && ./deploy.sh | tee /tmp/deploy.log" 61 | args: 62 | executable: /bin/bash 63 | 64 | -------------------------------------------------------------------------------- /ansible/sgx_host_pre.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - import_playbook: playbooks/sgx_host_pre.yml 3 | -------------------------------------------------------------------------------- /ansible/sgx_inv: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /ansible/site.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # file: site.yml 3 | - import_playbook: playbooks/common.yml 4 | - import_playbook: playbooks/control_plane.yml 5 | - import_playbook: playbooks/data_plane.yml 6 | -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2003-2018, Great Software Laboratory Pvt. Ltd. 4 | # Copyright (c) 2017 Intel Corporation 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | TERRAFORM_DIR=${PWD}/terraform 19 | TF_STATE_FILE="$TERRAFORM_DIR/terraform.tfstate" 20 | export TF_LOG_PATH="/var/log/terraform.log" 21 | export TF_LOG="DEBUG" 22 | GIT_USER=$1 23 | GIT_PASS=$2 24 | ANSIBLE_HOME="${PWD}/ansible" 25 | HOST_FILE="/etc/hosts" 26 | ANSIBLE_INV="$ANSIBLE_HOME/inventory" 27 | 28 | pushd $TERRAFORM_DIR/scripts 29 | 30 | #deleting existing ansible inventory file 31 | rm -rf $ANSIBLE_INV 32 | 33 | # Parse the input.cfg and generated the terrafrom variable (output.tfvars) file 34 | python parse_ini_input.py 35 | 36 | popd 37 | 38 | pushd $TERRAFORM_DIR 39 | # Terraform deploy 40 | if [ -f $TF_STATE_FILE ] ; then 41 | echo "Terraform state file exist, again not required terraform initialization." 42 | else 43 | terraform init 44 | fi 45 | 46 | terraform apply -auto-approve --var-file=input.tfvars --var-file=network_map.tfvars 47 | if [ $? -eq 0 ]; then 48 | echo "VM installation has been done successfully" 49 | else 50 | echo "some vms are installed with errors" 51 | fi 52 | 53 | #updating the hosts file for vm ip details 54 | VM_NAME=($(virsh list |awk '{print $2}' |sed 1,2d |sed '$d')) 55 | for i in ${VM_NAME[@]} 56 | do 57 | for vm_ip in `virsh domifaddr $i |grep ipv4 |awk '{print $4}' |cut -d '/' -f1` 58 | do 59 | cat $HOST_FILE |grep $i > /dev/null 2>&1 60 | if [ $? -eq 0 ] ; then 61 | sed -i.bak.`date "+%d%m%Y-%H%M"` "/$i/d" $HOST_FILE 62 | echo "$vm_ip $i" >> $HOST_FILE 63 | else 64 | echo "$vm_ip $i" >> $HOST_FILE 65 | fi 66 | #Generate the ansible inventory file 67 | echo -e "[$i]\n$vm_ip" >> $ANSIBLE_INV 68 | done 69 | done 70 | cat $ANSIBLE_INV |grep sgx 1> /dev/null 71 | if [ $? -ne 0 ]; then 72 | cat $ANSIBLE_HOME/sgx_inv >> $ANSIBLE_INV 73 | fi 74 | echo "Hosts file has been updated successfully" 75 | echo "Ansible inventory file has been updated successfully" 76 | popd 77 | #change to ansible home directory and execute ansible-playbook to configure the vm's. 78 | pushd $ANSIBLE_HOME 79 | ######################################################### 80 | # VM Configuration through ansible 81 | ######################################################### 82 | #/usr/bin/ansible-playbook -i inventory site.yml -u ubuntu -e 'ansible_python_interpreter=/usr/bin/python3' -e githubuser="$GIT_USER" -e githubpassword="$GIT_PASS" 83 | /usr/bin/ansible-playbook -i inventory site.yml -u ubuntu -e 'ansible_python_interpreter=/usr/bin/python3' 84 | popd 85 | -------------------------------------------------------------------------------- /destroy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2003-2018, Great Software Laboratory Pvt. Ltd. 4 | # Copyright (c) 2017 Intel Corporation 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | TERRAFORM_DIR=${PWD}/terraform 19 | 20 | export TF_LOG_PATH="/var/log/terraform.log" 21 | export TF_LOG="DEBUG" 22 | export PATH=$PATH:$TERRAFORM_DIR 23 | 24 | source $TERRAFORM_DIR/c3povm_defs.cfg 25 | 26 | pushd $TERRAFORM_DIR 27 | 28 | # Terraform destroy 29 | terraform destroy -auto-approve --var-file=input.tfvars --var-file=network_map.tfvars 30 | if [ $? -ne 0 ]; then 31 | echo "Terraform destory failed" 32 | exit 1 33 | fi 34 | 35 | popd 36 | rm -rf /var/lib/libvirt/images/* 37 | sleep 3 38 | 39 | VNF_INT="$CTRL_PFDEV $DP_CTRL_PFDEV" 40 | for interface in ${VNF_INT} 41 | do 42 | echo 0 > /sys/class/net/$interface/device/sriov_numvfs 43 | echo "Virtual functions are deleted on interface: $interface" 44 | done 45 | -------------------------------------------------------------------------------- /scripts/check_duplicate_networks.py: -------------------------------------------------------------------------------- 1 | import ConfigParser 2 | import sys 3 | 4 | S1MME=[] 5 | S11=[] 6 | S6A=[] 7 | DB=[] 8 | S5S8_SGWC =[] 9 | S5S8_PGWC=[] 10 | FPCNB=[] 11 | FPCSB=[] 12 | S1U=[] 13 | S5S8_SGWU=[] 14 | S5S8_PGWU=[] 15 | SGI=[] 16 | 17 | errors=[] 18 | def parse_ini_file(file): 19 | config = ConfigParser.ConfigParser() 20 | config.optionxform = str 21 | config.read(file) 22 | return config 23 | 24 | def check_network(config): 25 | for key, value in config.items("NETWORKS"): 26 | if value not in eval(key): 27 | eval(key).append(value) 28 | else: 29 | errors.append("Duplicate network found "+key+" in "+file) 30 | 31 | 32 | if __name__ == '__main__': 33 | if len(sys.argv)==1: 34 | print "Provide path of c3po_ngic_input.cfg of each frame separated by space " 35 | exit(0) 36 | else: 37 | #frames = ["frame1/c3po_ngic_input.cfg", "frame2/c3po_ngic_input.cfg","frame3/c3po_ngic_input.cfg"] 38 | iterfiles=iter(sys.argv) 39 | iterfiles.next() 40 | for file in iterfiles: 41 | print "Checking "+file 42 | check_network(parse_ini_file(file)) 43 | if len(errors) > 0: 44 | print(errors) -------------------------------------------------------------------------------- /scripts/get_vm_ip.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2003-2018, Great Software Laboratory Pvt. Ltd. 4 | # Copyright (c) 2017 Intel Corporation 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | virsh domifaddr $1 |grep ipv4 |awk '{print $4}' |cut -d '/' -f1 20 | -------------------------------------------------------------------------------- /scripts/listvfs_by_pf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | NIC_DIR="/sys/class/net" 4 | for i in $( ls $NIC_DIR) ; 5 | do 6 | if [ -d "${NIC_DIR}/$i/device" -a ! -L "${NIC_DIR}/$i/device/physfn" ]; then 7 | declare -a VF_PCI_BDF 8 | declare -a VF_INTERFACE 9 | k=0 10 | for j in $( ls "${NIC_DIR}/$i/device" ) ; 11 | do 12 | if [[ "$j" == "virtfn"* ]]; then 13 | VF_PCI=$( readlink "${NIC_DIR}/$i/device/$j" | cut -d '/' -f2 ) 14 | VF_PCI_BDF[$k]=$VF_PCI 15 | #get the interface name for the VF at this PCI Address 16 | for iface in $( ls $NIC_DIR ); 17 | do 18 | link_dir=$( readlink ${NIC_DIR}/$iface ) 19 | if [[ "$link_dir" == *"$VF_PCI"* ]]; then 20 | VF_INTERFACE[$k]=$iface 21 | # echo $iface 22 | fi 23 | done 24 | ((k++)) 25 | fi 26 | done 27 | NUM_VFs=${#VF_PCI_BDF[@]} 28 | if [[ $NUM_VFs -gt 0 ]]; then 29 | #get the PF Device Description 30 | PF_PCI=$( readlink "${NIC_DIR}/$i/device" | cut -d '/' -f4 ) 31 | PF_VENDOR=$( lspci -vmmks $PF_PCI | grep ^Vendor | cut -f2) 32 | PF_NAME=$( lspci -vmmks $PF_PCI | grep ^Device | cut -f2). 33 | echo "Virtual Functions on $PF_VENDOR $PF_NAME ($i):" 34 | echo -e "PCI BDF\t\tInterface" 35 | echo -e "=======\t\t=========" 36 | for (( l = 0; l < $NUM_VFs; l++ )) ; 37 | do 38 | echo -e "${VF_PCI_BDF[$l]}\t${VF_INTERFACE[$l]}" 39 | done 40 | unset VF_PCI_BDF 41 | unset VF_INTERFACE 42 | echo " " 43 | fi 44 | fi 45 | done 46 | -------------------------------------------------------------------------------- /scripts/prerequisite.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2003-2018, Great Software Laboratory Pvt. Ltd. 4 | # Copyright (c) 2017 Intel Corporation 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | USER="ubuntu" 20 | IMAGE_PATH="/opt/ubuntu-16.04-server-cloudimg-amd64-disk1.img" 21 | TERRAFORM_BIN_PATH="/usr/local/bin/terraform" 22 | download_dir="/opt" 23 | echo "**************Prerequsite Test***********************" 24 | echo "KVM pool validation: -" 25 | echo "-------------------" 26 | POOL_NAME=`virsh pool-list | grep images | awk '{ print $1 }'` 27 | POOL_STATUS=`virsh pool-list | grep images | awk '{ print $2 }'` 28 | if [ "$POOL_NAME" == "images" -a "$POOL_STATUS" == "active" ] ; then 29 | echo "$POOL_NAME pool already exist" 30 | else 31 | if [ -e "/var/lib/libvirt/images" ] ; then 32 | virsh pool-define-as images --type dir --target /var/lib/libvirt/images 33 | virsh pool-autostart images 34 | virsh pool-start images 35 | else 36 | mkdir -p /var/lib/libvirt/images 37 | virsh pool-define-as images --type dir --target /var/lib/libvirt/images 38 | virsh pool-autostart images 39 | virsh pool-start images 40 | fi 41 | fi 42 | 43 | echo "User validation: -" 44 | echo "---------------" 45 | ###User validation and creation of user not exist 46 | if getent passwd $USER > /dev/null 2>&1; then 47 | echo "$USER user already exist" 48 | else 49 | useradd -d /home/$USER -m $USER 50 | mkdir /home/$USER/.ssh 51 | sudo -u $USER bash -c echo -e "\n\n\n" | ssh-keygen -t rsa -f /home/$USER/.ssh/id_rsa -q -N "" 52 | chown $USER:$USER -R /home/$USER/.ssh/ 53 | echo "$USER has been created and ssh key generated" 54 | # sudo -u $USER bash -c cat /dev/zero | ssh-keygen -t rsa -f /home/$USER/.ssh/id_rsa -q -N "" 55 | fi 56 | 57 | ##Download the ubuntu cloud image and terraform packages 58 | echo "Downloading Packages:-" 59 | echo "---------------------" 60 | if [ -e $IMAGE_PATH ] ; then 61 | echo "Ubuntu cloud image already exist" 62 | else 63 | echo "Downloding Ubuntu cloud image" 64 | wget https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img -P $download_dir 65 | qemu-img resize $IMAGE_PATH 16GB 66 | fi 67 | if [ -e $TERRAFORM_BIN_PATH ]; then 68 | echo "Terraform binary already present.." 69 | else 70 | echo "downloading terraform binary" 71 | apt-get install zip -y 72 | wget -qO- -O $download_dir/terraform.zip https://releases.hashicorp.com/terraform/0.11.7/terraform_0.11.7_linux_amd64.zip && unzip $download_dir/terraform.zip -d $download_dir && rm $download_dir/terraform.zip && mv $download_dir/terraform $TERRAFORM_BIN_PATH 73 | #Verify terraform is installed succesfully 74 | terraform -version 75 | if [ $? -eq 0 ]; then 76 | echo "Terraform installed successfully." 77 | else 78 | echo "Terraform installation failed." 79 | fi 80 | fi 81 | -------------------------------------------------------------------------------- /scripts/sshvm.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Copyright (c) 2003-2018, Great Software Laboratory Pvt. Ltd. 4 | # Copyright (c) 2017 Intel Corporation 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | 20 | login=$1 21 | vmname=$2 22 | 23 | #vmlist=($(virsh net-dhcp-leases default | grep "ipv4" | awk '{ print $6; }')) 24 | vmlist=($(virsh list --name)) 25 | 26 | if [ "$vmname" == "" ] 27 | then 28 | echo use: $0 \ \ 29 | echo use a domain in: ${vmlist[*]} 30 | exit 1 31 | fi 32 | 33 | if ./get_vm_ip.sh $vmname 34 | then 35 | ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /home/$1/.ssh/id_rsa $login@$(./get_vm_ip.sh $vmname) 36 | else 37 | echo domain \"$vmname\" not found 38 | echo use a domain in: ${vmlist[*]} 39 | fi 40 | -------------------------------------------------------------------------------- /setupremote/cleanup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2003-2018, Great Software Laboratory Pvt. Ltd. 4 | # Copyright (c) 2017 Intel Corporation 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ANSIBLE_HOME="../ansible" 20 | 21 | #python scripts/collect_host_inv.py 22 | 23 | pushd $ANSIBLE_HOME 24 | 25 | /usr/bin/ansible-playbook -i inv cleanup.yml -u ubuntu -e 'ansible_python_interpreter=/usr/bin/python3' 26 | 27 | -------------------------------------------------------------------------------- /setupremote/prerequisite.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | USER="ubuntu" 3 | echo "**************Prerequsite Test***********************" 4 | echo "Ansible" 5 | echo "-------------------" 6 | 7 | if ! type -P ansible-playbook > /dev/null; then 8 | apt-get -y install software-properties-common 9 | 10 | echo "Installing ansible" 11 | apt-add-repository ppa:ansible/ansible 12 | apt-get update 13 | apt-get --assume-yes install ansible 14 | fi 15 | -------------------------------------------------------------------------------- /setupremote/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2003-2018, Great Software Laboratory Pvt. Ltd. 4 | # Copyright (c) 2017 Intel Corporation 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ANSIBLE_HOME="../ansible" 20 | 21 | python scripts/collect_host_inv.py 22 | 23 | pushd $ANSIBLE_HOME 24 | 25 | /usr/bin/ansible-playbook -i inv main.yml -u ubuntu -e 'ansible_python_interpreter=/usr/bin/python3' | sudo tee /tmp/deploy.log 26 | -------------------------------------------------------------------------------- /setupremote/scripts/check_vms_constants.py: -------------------------------------------------------------------------------- 1 | #configuration 2 | event_interval=1 3 | mme_created_cmd="cat /tmp/deploy.log | grep \"mme: Creation complete \"" 4 | mme_configured_cmd="cat /tmp/deploy.log | grep \"Installation and configuration of hss\"" 5 | hss_created_cmd="cat /tmp/deploy.log | grep \"hss: Creation complete \"" 6 | hss_configured_cmd="cat /tmp/deploy.log | grep \"Installation and configuration of db\"" 7 | db_created_cmd="cat /tmp/deploy.log | grep \"db: Creation complete \"" 8 | db_configured_cmd="cat /tmp/deploy.log | grep \"Installation and configuration of spgwc\"" 9 | #fpc_created_cmd="cat /tmp/deploy.log | grep \"fpc: Creation complete \"" 10 | #fpc_configured_cmd="cat /tmp/deploy.log | grep \"Installation and configuration of DNS\"" 11 | spgwc_created_cmd="cat /tmp/deploy.log | grep \"spgwc: Creation complete \"" 12 | spgwc_configured_cmd="cat /tmp/deploy.log | grep \"Installation and configuration of FPC\"" 13 | spgwu_created_cmd="cat /tmp/deploy.log | grep \"spgwu: Creation complete \"" 14 | spgwu_configured_cmd="cat /tmp/deploy.log | grep \"spgwu : DPDK Binding for S1U and SGI Interface\"" 15 | status_lcmd="cat /tmp/deploy.log | grep TASK | tail -1 | cut -d '|' -f 2 | cut -d \"*\" -f1" 16 | status_rcmd="cat /tmp/deploy.log | grep TASK | tail -1 | cut -d \"*\" -f1" 17 | host_change_cmd="cat /tmp/deploy.log | grep \"PLAY RECAP\"" 18 | #vms=['MME','HSS','DB','FPC','SPGWC','SPGWU'] 19 | vms=['MME','HSS','DB','SPGWC','SPGWU'] 20 | -------------------------------------------------------------------------------- /setupremote/scripts/show_progress.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2003-2018, Great Software Laboratory Pvt. Ltd. 4 | # Copyright (c) 2017 Intel Corporation 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | #cleanup log CHANGEME 20 | touch /tmp/deploy.log 21 | 22 | python check_vms.py 23 | -------------------------------------------------------------------------------- /terraform/.terraform/plugins/linux_amd64/lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "libvirt": "63f067f0682ec4292a54c381e1abac5dd4144dcb68e09ea5ab2ca98a48166028" 3 | } -------------------------------------------------------------------------------- /terraform/autogen_new.cfg: -------------------------------------------------------------------------------- 1 | DEF_IF_S11_VM_NGIC_CP1_PCI = 0000:03:10.1 2 | DEF_IF_S5S8_SGWC_VM_NGIC_CP1_PCI = 0000:03:10.3 3 | DEF_IF_S5S8_PGWC_VM_NGIC_CP2_PCI = 0000:03:12.5 4 | DEF_IF_ODL_NB_VM_NGIC_CP1_PCI = 0000:03:12.7 5 | DEF_IF_ODL_NB_VM_NGIC_CP2_PCI = 0000:03:13.1 6 | DEF_IF_ODL_NB_VM_FPC_ODL1_PCI = 0000:03:13.3 7 | DEF_IF_ODL_SB_VM_FPC_ODL1_PCI = 0000:03:13.5 8 | DEF_IF_MME_S11_VM_C3PO_MME1_PCI = 0000:03:13.7 9 | DEF_IF_MME_S6_VM_C3PO_MME1_PCI = 0000:03:14.1 10 | DEF_IF_HSS_S6_VM_C3PO_HSS1_PCI = 0000:03:10.5 11 | DEF_IF_HSS_DB_VM_C3PO_HSS1_PCI = 0000:03:10.7 12 | DEF_IF_DBN_HSS_VM_C3PO_DBN1_PCI = 0000:03:11.1 13 | DEF_IF_ODL_SB_VM_NGIC_DP1_PCI = 0000:03:11.3 14 | AVAILABLE_PCI = 0000:03:11.5 15 | AVAILABLE_PCI = 0000:03:11.7 16 | AVAILABLE_PCI = 0000:03:12.1 17 | AVAILABLE_PCI = 0000:03:12.3 18 | -------------------------------------------------------------------------------- /terraform/c3povm_defs.cfg: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Intel Corporation 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # ############################################################################# 16 | # Script to create/assign sriov virtual functions (VF) 17 | # 18 | # Authors: 19 | # Sunder Rajan, Ashok 20 | # Martin Mc Donald 21 | # 22 | # ############################################################################# 23 | 24 | # read from shell script with: 25 | # source c3povm_defs.cfg 26 | 27 | # Define Control plane S1MME MACVTAP IF name 28 | S1MME_PFDEV= 29 | 30 | # Define c3po[MME, HSS, Cassandra, DNS, CTF, CDF] SRIOV IF 31 | INIT_NUM_CTRL_VF=0 32 | NUM_CTRL_VF=17 33 | CTRL_PFDEV= 34 | 35 | # Define Data to Control Plane PCI Devices 36 | NUM_DP_CTRL_PF=2 37 | DP_CTRL_PFDEV= 38 | # Define Data Plane PCI Devices 39 | # nodedev-list format: pci____ 40 | NUM_DTPL_DP2_PF=2 41 | DTPL_DP2_PFDEV= 42 | DEF_IF_S5S8_VM_NGIC_DP2_PCI= 43 | DEF_IF_SGI_VM_NGIC_DP2_PCI= 44 | NUM_DTPL_DP1_PF=2 45 | DTPL_DP1_PFDEV= 46 | DEF_IF_S1U_VM_NGIC_DP1_PCI= 47 | DEF_IF_S5S8_VM_NGIC_DP1_PCI= 48 | -------------------------------------------------------------------------------- /terraform/c3povm_defs.cfg.blank: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Intel Corporation 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # ############################################################################# 16 | # Script to create/assign sriov virtual functions (VF) 17 | # 18 | # Authors: 19 | # Sunder Rajan, Ashok 20 | # Martin Mc Donald 21 | # 22 | # ############################################################################# 23 | 24 | # read from shell script with: 25 | # source c3povm_defs.cfg 26 | 27 | # Define Control plane S1MME MACVTAP IF name 28 | S1MME_PFDEV= 29 | 30 | # Define c3po[MME, HSS, Cassandra, DNS, CTF, CDF] SRIOV IF 31 | INIT_NUM_CTRL_VF=0 32 | NUM_CTRL_VF=17 33 | CTRL_PFDEV= 34 | 35 | # Define Data to Control Plane PCI Devices 36 | NUM_DP_CTRL_PF=4 37 | DP_CTRL_PFDEV= 38 | # Define Data Plane PCI Devices 39 | # nodedev-list format: pci____ 40 | NUM_DTPL_DP2_PF=2 41 | DTPL_DP2_PFDEV= 42 | DEF_IF_S5S8_VM_NGIC_DP2_PCI= 43 | DEF_IF_SGI_VM_NGIC_DP2_PCI= 44 | NUM_DTPL_DP1_PF=2 45 | DTPL_DP1_PFDEV= 46 | DEF_IF_S1U_VM_NGIC_DP1_PCI= 47 | DEF_IF_S5S8_VM_NGIC_DP1_PCI= 48 | -------------------------------------------------------------------------------- /terraform/common.tf: -------------------------------------------------------------------------------- 1 | # instance the provider 2 | provider "libvirt" { 3 | uri = "qemu:///system" 4 | } 5 | -------------------------------------------------------------------------------- /terraform/db_vm.tf: -------------------------------------------------------------------------------- 1 | resource "libvirt_volume" "db-qcow2" { 2 | name = "db.qcow2" 3 | count = "${var.DB_VM_COUNT}" 4 | pool = "images" 5 | source = "${var.DISK_IMAGE_PATH}" 6 | format = "qcow2" 7 | } 8 | resource "libvirt_volume" "db-data-qcow2" { 9 | name = "db-data-qcow2" 10 | count = "${var.DB_VM_COUNT}" 11 | pool = "images" 12 | format = "qcow2" 13 | size = "${var.DB_DISK_SIZE}" 14 | } 15 | resource "libvirt_cloudinit" "dbinit" { 16 | name = "dbinit.iso" 17 | count = "${var.DB_VM_COUNT}" 18 | pool = "images" 19 | local_hostname = "db" 20 | ssh_authorized_key = "${file("${var.SSH_AUTHRIZED_KEY}")}" 21 | } 22 | resource "libvirt_domain" "domain-db" { 23 | name = "db" 24 | memory = "${var.DB_MEM}" 25 | vcpu = "${var.DB_CPU}" 26 | cputune { 27 | cpuset = "${var.CORE_RANGE_DB}" 28 | } 29 | cpu { 30 | mode ="host-model" 31 | } 32 | count = "${var.DB_VM_COUNT}" 33 | cloudinit = "${libvirt_cloudinit.dbinit.id}" 34 | network_interface { 35 | hostname = "db" 36 | network_name = "default" 37 | wait_for_lease = true 38 | } 39 | network_interface { 40 | addresses = ["${var.IP_DBN_HSS_VM_C3PO_DBN1_PCI}"] 41 | passthrough = "${var.DEF_IF_DBN_HSS_VM_C3PO_DBN1_PCI}" 42 | } 43 | provisioner "local-exec" { 44 | command = "echo 'sleeping'" 45 | } 46 | provisioner "local-exec" { 47 | command = "sleep 80" 48 | } 49 | provisioner "local-exec" { 50 | command = "echo 'done sleeping'" 51 | } 52 | provisioner "file" { 53 | source = "interfaces-db" 54 | destination = "/tmp/interfaces" 55 | connection { 56 | type = "ssh" 57 | user = "ubuntu" 58 | agent = "false" 59 | private_key = "${file("${var.PRIVATE_SSH_KEY}")}" 60 | } 61 | } 62 | provisioner "remote-exec" { 63 | inline = [ 64 | "sudo cp /tmp/interfaces /etc/network/interfaces", 65 | "sudo ifup ens4" 66 | 67 | ] 68 | connection { 69 | type = "ssh" 70 | user = "ubuntu" 71 | private_key = "${file("${var.PRIVATE_SSH_KEY}")}" 72 | } 73 | } 74 | console { 75 | type = "pty" 76 | target_port = "0" 77 | target_type = "serial" 78 | } 79 | console { 80 | type = "pty" 81 | target_type = "virtio" 82 | target_port = "1" 83 | } 84 | disk { 85 | volume_id = "${libvirt_volume.db-qcow2.id}" 86 | } 87 | disk { 88 | volume_id = "${libvirt_volume.db-data-qcow2.id}" 89 | } 90 | graphics { 91 | type = "spice" 92 | listen_type = "address" 93 | autoport = "true" 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /terraform/fpc_vm.tf: -------------------------------------------------------------------------------- 1 | resource "libvirt_volume" "fpc-qcow2" { 2 | name = "fpc.qcow2" 3 | count = "${var.FPC_VM_COUNT}" 4 | pool = "images" 5 | source = "${var.DISK_IMAGE_PATH}" 6 | format = "qcow2" 7 | } 8 | resource "libvirt_volume" "fpc-data-qcow2" { 9 | name = "fpc-data-qcow2" 10 | count = "${var.FPC_VM_COUNT}" 11 | pool = "images" 12 | format = "qcow2" 13 | size = "${var.FPC_DISK_SIZE}" 14 | } 15 | 16 | resource "libvirt_cloudinit" "fpcinit" { 17 | name = "fpcinit.iso" 18 | pool = "images" 19 | count = "${var.FPC_VM_COUNT}" 20 | local_hostname = "fpc" 21 | ssh_authorized_key = "${file("${var.SSH_AUTHRIZED_KEY}")}" 22 | } 23 | resource "libvirt_domain" "domain-fpc" { 24 | name = "fpc" 25 | memory = "${var.FPC_MEM}" 26 | vcpu = "${var.FPC_CPU}" 27 | cputune { 28 | cpuset = "${var.CORE_RANGE_FPC}" 29 | } 30 | cpu { 31 | mode ="host-model" 32 | } 33 | count = "${var.FPC_VM_COUNT}" 34 | cloudinit = "${libvirt_cloudinit.fpcinit.id}" 35 | network_interface { 36 | hostname = "fpc" 37 | network_name = "default" 38 | wait_for_lease = true 39 | } 40 | network_interface { 41 | addresses = ["${var.IP_ODL_NB_VM_FPC_ODL1_PCI}"] 42 | passthrough = "${var.DEF_IF_ODL_NB_VM_FPC_ODL1_PCI}" 43 | } 44 | network_interface { 45 | addresses = ["${var.IP_ODL_SB_VM_FPC_ODL1_PCI}"] 46 | passthrough = "${var.DEF_IF_ODL_SB_VM_FPC_ODL1_PCI}" 47 | } 48 | provisioner "local-exec" { 49 | command = "echo 'sleeping'" 50 | } 51 | provisioner "local-exec" { 52 | command = "sleep 155" 53 | } 54 | provisioner "local-exec" { 55 | command = "echo 'done sleeping'" 56 | } 57 | provisioner "file" { 58 | source = "interfaces-fpc" 59 | destination = "/tmp/interfaces" 60 | connection { 61 | type = "ssh" 62 | user = "ubuntu" 63 | agent = "false" 64 | private_key = "${file("${var.PRIVATE_SSH_KEY}")}" 65 | } 66 | } 67 | provisioner "remote-exec" { 68 | inline = [ 69 | "sudo cp /tmp/interfaces /etc/network/interfaces", 70 | "sudo ifup ens4", 71 | "sudo ifup ens5" 72 | ] 73 | connection { 74 | type = "ssh" 75 | user = "ubuntu" 76 | agent = "false" 77 | private_key = "${file("${var.PRIVATE_SSH_KEY}")}" 78 | } 79 | } 80 | console { 81 | type = "pty" 82 | target_port = "0" 83 | target_type = "serial" 84 | } 85 | console { 86 | type = "pty" 87 | target_type = "virtio" 88 | target_port = "1" 89 | } 90 | disk { 91 | volume_id = "${libvirt_volume.fpc-qcow2.id}" 92 | } 93 | disk { 94 | volume_id = "${libvirt_volume.fpc-data-qcow2.id}" 95 | } 96 | 97 | graphics { 98 | type = "spice" 99 | listen_type = "address" 100 | autoport = "true" 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /terraform/host_type.cfg: -------------------------------------------------------------------------------- 1 | 2 | HOST_TYPE1 3 | INSTANCE_COUNT = 2 4 | CORES_PER_NODE = 22 5 | CORES_TOTAL = 44 6 | MEMORY GB = 128 7 | DISK GB = 480 8 | NUMA_NODES = 2 9 | NW.ONBD = "2x10GbE" 10 | NW.FV710 = 16x10GbE = 4x(4x10GbE) 11 | -------------------------------------------------------------------------------- /terraform/hss_vm.tf: -------------------------------------------------------------------------------- 1 | resource "libvirt_volume" "hss-qcow2" { 2 | name = "hss.qcow2" 3 | count = "${var.HSS_VM_COUNT}" 4 | pool = "images" 5 | source = "${var.DISK_IMAGE_PATH}" 6 | format = "qcow2" 7 | } 8 | resource "libvirt_volume" "hss-data-qcow2" { 9 | name = "hss-data-qcow2" 10 | count = "${var.HSS_VM_COUNT}" 11 | pool = "images" 12 | format = "qcow2" 13 | size = "${var.HSS_DISK_SIZE}" 14 | } 15 | resource "libvirt_cloudinit" "hssinit" { 16 | name = "hssinit.iso" 17 | pool = "images" 18 | count = "${var.HSS_VM_COUNT}" 19 | local_hostname = "hss" 20 | ssh_authorized_key = "${file("${var.SSH_AUTHRIZED_KEY}")}" 21 | } 22 | resource "libvirt_domain" "domain-hss" { 23 | name = "hss" 24 | memory = "${var.HSS_MEM}" 25 | vcpu = "${var.HSS_CPU}" 26 | cputune { 27 | cpuset = "${var.CORE_RANGE_HSS}" 28 | } 29 | cpu { 30 | mode ="host-model" 31 | } 32 | 33 | count = "${var.HSS_VM_COUNT}" 34 | cloudinit = "${libvirt_cloudinit.hssinit.id}" 35 | lifecycle { 36 | ignore_changes = ["user_data"] 37 | } 38 | 39 | network_interface { 40 | hostname = "hss" 41 | network_name = "default" 42 | wait_for_lease = true 43 | } 44 | network_interface { 45 | addresses = ["${var.IP_HSS_DB_VM_C3PO_HSS1_PCI}"] 46 | passthrough = "${var.DEF_IF_HSS_DB_VM_C3PO_HSS1_PCI}" 47 | } 48 | network_interface { 49 | addresses = ["${var.IP_HSS_S6_VM_C3PO_HSS1_PCI}"] 50 | passthrough = "${var.DEF_IF_HSS_S6_VM_C3PO_HSS1_PCI}" 51 | } 52 | provisioner "local-exec" { 53 | command = "echo 'sleeping'" 54 | } 55 | provisioner "local-exec" { 56 | command = "sleep 55" 57 | } 58 | provisioner "local-exec" { 59 | command = "echo 'done sleeping'" 60 | } 61 | provisioner "file" { 62 | source = "interfaces-hss" 63 | destination = "/tmp/interfaces" 64 | connection { 65 | type = "ssh" 66 | user = "ubuntu" 67 | agent = "false" 68 | private_key = "${file("${var.PRIVATE_SSH_KEY}")}" 69 | } 70 | } 71 | provisioner "remote-exec" { 72 | inline = [ 73 | "sudo cp /tmp/interfaces /etc/network/interfaces", 74 | "sudo ifup ens4", 75 | "sudo ifup ens5" 76 | ] 77 | connection { 78 | type = "ssh" 79 | user = "ubuntu" 80 | agent = "false" 81 | private_key = "${file("${var.PRIVATE_SSH_KEY}")}" 82 | } 83 | } 84 | console { 85 | type = "pty" 86 | target_port = "0" 87 | target_type = "serial" 88 | } 89 | console { 90 | type = "pty" 91 | target_type = "virtio" 92 | target_port = "1" 93 | } 94 | disk { 95 | volume_id = "${libvirt_volume.hss-qcow2.id}" 96 | } 97 | disk { 98 | volume_id = "${libvirt_volume.hss-data-qcow2.id}" 99 | 100 | } 101 | graphics { 102 | type = "spice" 103 | listen_type = "address" 104 | autoport = "true" 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /terraform/il_nperf_vm.tf: -------------------------------------------------------------------------------- 1 | resource "libvirt_volume" "il_nperf-qcow2" { 2 | name = "il_nperf.qcow2" 3 | count = "${var.IL_NPERF_VM_COUNT}" 4 | pool = "images" #CHANGE_ME 5 | source = "${var.DISK_IMAGE_PATH}" 6 | format = "qcow2" 7 | } 8 | # Use CloudInit to add our ssh-key to the instance 9 | resource "libvirt_cloudinit" "il_nperfinit" { 10 | name = "il_nperfinit.iso" 11 | pool = "images" #CHANGEME 12 | count = "${var.IL_NPERF_VM_COUNT}" 13 | local_hostname = "il_nperf" 14 | ssh_authorized_key = "${file("${var.SSH_AUTHRIZED_KEY}")}" 15 | } 16 | # Create the machine for il_nperf 17 | resource "libvirt_domain" "domain-il_nperf" { 18 | name = "il_nperf" 19 | memory = "${var.IL_NPERF_MEM}" 20 | vcpu = "${var.IL_NPERF_CPU}" 21 | cputune { 22 | cpuset = [ "60","61","62","63","64","65","66","67" ] 23 | } 24 | cpu { 25 | mode ="host-model" 26 | } 27 | 28 | count = "${var.IL_NPERF_VM_COUNT}" 29 | cloudinit = "${libvirt_cloudinit.il_nperfinit.id}" 30 | network_interface { 31 | hostname = "il_nperf" 32 | network_name = "default" 33 | } 34 | network_interface { 35 | addresses = ["${var.IP_S1U_IP_ILNPERF_PCI}"] 36 | passthrough = "${var.DEF_IF_S1U_IP_ILNPERF_PCI}" 37 | } 38 | network_interface { 39 | addresses = ["${var.IP_SGI_IP_ILNPERF_PCI}"] 40 | passthrough = "${var.DEF_IF_SGI_IP_ILNPERF_PCI}" 41 | } 42 | provisioner "file" { 43 | source = "interfaces-il_nperf" 44 | destination = "/tmp/interfaces" 45 | connection { 46 | type = "ssh" 47 | user = "ubuntu" 48 | private_key = "${file("${var.PRIVATE_SSH_KEY}")}" 49 | } 50 | } 51 | provisioner "remote-exec" { 52 | inline = [ 53 | "sudo cp /tmp/interfaces /etc/network/interfaces", 54 | "sudo ifup ens4", 55 | "sudo ifup ens5", 56 | "sudo ifup ens6" 57 | ] 58 | connection { 59 | type = "ssh" 60 | user = "ubuntu" 61 | private_key = "${file("${var.PRIVATE_SSH_KEY}")}" 62 | } 63 | } 64 | # IMPORTANT 65 | # Ubuntu can hang is a isa-serial is not present at boot time. 66 | # If you find your CPU 100% and never is available this is why 67 | console { 68 | type = "pty" 69 | target_port = "0" 70 | target_type = "serial" 71 | } 72 | console { 73 | type = "pty" 74 | target_type = "virtio" 75 | target_port = "1" 76 | } 77 | disk { 78 | volume_id = "${libvirt_volume.il_nperf-qcow2.id}" 79 | } 80 | graphics { 81 | type = "spice" 82 | listen_type = "address" 83 | autoport = "true" 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /terraform/input.tfvars: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omec-project/deployment/18ae3b2d11b073b50f92ab279f61605fd22b776e/terraform/input.tfvars -------------------------------------------------------------------------------- /terraform/interfaces-db: -------------------------------------------------------------------------------- 1 | # This file describes the network interfaces available on your system 2 | # and how to activate them. For more information, see interfaces(5). 3 | source /etc/network/interfaces.d/* 4 | # The loopback network interface 5 | auto lo 6 | iface lo inet loopback 7 | # The primary network interface 8 | auto ens3 9 | iface ens3 inet dhcp 10 | 11 | # The DB communication interface 12 | auto ens4 13 | iface ens4 inet static 14 | address 10.0.4.60 15 | netmask 255.255.255.0 16 | network 10.0.4.0 17 | 18 | -------------------------------------------------------------------------------- /terraform/interfaces-fpc: -------------------------------------------------------------------------------- 1 | # This file describes the network interfaces available on your system 2 | # and how to activate them. For more information, see interfaces(5). 3 | source /etc/network/interfaces.d/* 4 | # The loopback network interface 5 | auto lo 6 | iface lo inet loopback 7 | # The primary network interface 8 | auto ens3 9 | iface ens3 inet dhcp 10 | 11 | # The FPCNB communication interface 12 | auto ens4 13 | iface ens4 inet static 14 | address 10.0.7.100 15 | netmask 255.255.255.0 16 | network 10.0.7.0 17 | 18 | # The FPCSB communication interface 19 | auto ens5 20 | iface ens5 inet static 21 | address 10.0.8.110 22 | netmask 255.255.255.0 23 | network 10.0.8.0 24 | 25 | -------------------------------------------------------------------------------- /terraform/interfaces-hss: -------------------------------------------------------------------------------- 1 | # This file describes the network interfaces available on your system 2 | # and how to activate them. For more information, see interfaces(5). 3 | source /etc/network/interfaces.d/* 4 | # The loopback network interface 5 | auto lo 6 | iface lo inet loopback 7 | # The primary network interface 8 | auto ens3 9 | iface ens3 inet dhcp 10 | 11 | # The S6A communication interface 12 | auto ens4 13 | iface ens4 inet static 14 | address 10.0.3.40 15 | netmask 255.255.255.0 16 | network 10.0.3.0 17 | 18 | # The DB communication interface 19 | auto ens5 20 | iface ens5 inet static 21 | address 10.0.4.50 22 | netmask 255.255.255.0 23 | network 10.0.4.0 24 | 25 | -------------------------------------------------------------------------------- /terraform/interfaces-mme: -------------------------------------------------------------------------------- 1 | # This file describes the network interfaces available on your system 2 | # and how to activate them. For more information, see interfaces(5). 3 | source /etc/network/interfaces.d/* 4 | # The loopback network interface 5 | auto lo 6 | iface lo inet loopback 7 | # The primary network interface 8 | auto ens3 9 | iface ens3 inet dhcp 10 | 11 | # The S6A communication interface 12 | auto ens4 13 | iface ens4 inet static 14 | address 10.0.3.10 15 | netmask 255.255.255.0 16 | network 10.0.3.0 17 | 18 | # The S11 communication interface 19 | auto ens5 20 | iface ens5 inet static 21 | address 10.0.2.20 22 | netmask 255.255.255.0 23 | network 10.0.2.0 24 | 25 | # The S1MME communication interface 26 | auto ens6 27 | iface ens6 inet static 28 | address 10.0.1.30 29 | netmask 255.255.255.0 30 | network 10.0.1.0 31 | 32 | -------------------------------------------------------------------------------- /terraform/interfaces-spgwc: -------------------------------------------------------------------------------- 1 | # This file describes the network interfaces available on your system 2 | # and how to activate them. For more information, see interfaces(5). 3 | source /etc/network/interfaces.d/* 4 | # The loopback network interface 5 | auto lo 6 | iface lo inet loopback 7 | # The primary network interface 8 | auto ens3 9 | iface ens3 inet dhcp 10 | 11 | # The S11 communication interface 12 | auto ens4 13 | iface ens4 inet static 14 | address 10.0.2.70 15 | netmask 255.255.255.0 16 | network 10.0.2.0 17 | 18 | # The FPCNB communication interface 19 | auto ens5 20 | iface ens5 inet static 21 | address 10.0.7.80 22 | netmask 255.255.255.0 23 | network 10.0.7.0 24 | 25 | # The S5S8_SGWC communication interface 26 | auto ens6 27 | iface ens6 inet static 28 | address 10.0.5.90 29 | netmask 255.255.255.0 30 | network 10.0.5.0 31 | 32 | -------------------------------------------------------------------------------- /terraform/interfaces-spgwu: -------------------------------------------------------------------------------- 1 | # This file describes the network interfaces available on your system 2 | # and how to activate them. For more information, see interfaces(5). 3 | source /etc/network/interfaces.d/* 4 | # The loopback network interface 5 | auto lo 6 | iface lo inet loopback 7 | # The primary network interface 8 | auto ens3 9 | iface ens3 inet dhcp 10 | 11 | # The FPCSB communication interface 12 | auto ens4 13 | iface ens4 inet static 14 | address 10.0.8.120 15 | netmask 255.255.255.0 16 | network 10.0.8.0 17 | 18 | # The S1U communication interface 19 | auto ens5 20 | iface ens5 inet static 21 | address 10.0.9.130 22 | netmask 255.255.255.0 23 | network 10.0.9.0 24 | 25 | # The SGI communication interface 26 | auto ens6 27 | iface ens6 inet static 28 | address 10.0.10.140 29 | netmask 255.255.255.0 30 | network 10.0.10.0 31 | 32 | -------------------------------------------------------------------------------- /terraform/mme_vm.tf: -------------------------------------------------------------------------------- 1 | resource "libvirt_volume" "mme-qcow2" { 2 | name = "mme.qcow2" 3 | count = "${var.MME_VM_COUNT}" 4 | pool = "images" #CHANGE_ME 5 | source = "${var.DISK_IMAGE_PATH}" 6 | format = "qcow2" 7 | } 8 | resource "libvirt_volume" "mme-data-qcow2" { 9 | name = "mme-data-qcow2" 10 | count = "${var.MME_VM_COUNT}" 11 | pool = "images" 12 | format = "qcow2" 13 | size = "${var.MME_DISK_SIZE}" 14 | } 15 | 16 | resource "libvirt_cloudinit" "mmeinit" { 17 | name = "mmeinit.iso" 18 | pool = "images" 19 | count = "${var.MME_VM_COUNT}" 20 | local_hostname = "mme" 21 | ssh_authorized_key = "${file("${var.SSH_AUTHRIZED_KEY}")}" 22 | } 23 | resource "libvirt_domain" "domain-mme" { 24 | name = "mme" 25 | memory = "${var.MME_MEM}" 26 | vcpu = "${var.MME_CPU}" 27 | cputune { 28 | cpuset = "${var.CORE_RANGE_MME}" 29 | } 30 | cpu { 31 | mode ="host-model" 32 | } 33 | 34 | count = "${var.MME_VM_COUNT}" 35 | cloudinit = "${libvirt_cloudinit.mmeinit.id}" 36 | network_interface { 37 | hostname = "mme" 38 | network_name = "default" 39 | wait_for_lease = true 40 | } 41 | 42 | network_interface { 43 | addresses = ["${var.IP_MME_S6_VM_C3PO_MME1_PCI}"] 44 | passthrough = "${var.DEF_IF_MME_S6_VM_C3PO_MME1_PCI}" 45 | } 46 | network_interface { 47 | addresses = ["${var.IP_MME_S11_VM_C3PO_MME1_PCI}"] 48 | passthrough = "${var.DEF_IF_MME_S11_VM_C3PO_MME1_PCI}" 49 | } 50 | hostdev { 51 | passthrough = "${var.DEF_IF_MME_S1MME_VM_C3PO_MME1_PCI}" 52 | } 53 | provisioner "local-exec" { 54 | command = "echo 'sleeping'" 55 | } 56 | provisioner "local-exec" { 57 | command = "sleep 30" 58 | } 59 | provisioner "local-exec" { 60 | command = "echo 'done sleeping'" 61 | } 62 | provisioner "file" { 63 | source = "interfaces-mme" 64 | destination = "/tmp/interfaces" 65 | connection { 66 | type = "ssh" 67 | user = "ubuntu" 68 | agent = "false" 69 | private_key = "${file("${var.PRIVATE_SSH_KEY}")}" 70 | } 71 | } 72 | provisioner "remote-exec" { 73 | inline = [ 74 | "sudo cp /tmp/interfaces /etc/network/interfaces", 75 | "sudo ifup ens4", 76 | "sudo ifup ens5" 77 | #"sudo ifup ens9" 78 | 79 | ] 80 | connection { 81 | type = "ssh" 82 | user = "ubuntu" 83 | agent = "false" 84 | private_key = "${file("${var.PRIVATE_SSH_KEY}")}" 85 | } 86 | } 87 | # IMPORTANT 88 | # Ubuntu can hang is a isa-serial is not present at boot time. 89 | # If you find your CPU 100% and never is available this is why 90 | console { 91 | type = "pty" 92 | target_port = "0" 93 | target_type = "serial" 94 | } 95 | console { 96 | type = "pty" 97 | target_type = "virtio" 98 | target_port = "1" 99 | } 100 | disk { 101 | volume_id = "${libvirt_volume.mme-qcow2.id}" 102 | } 103 | disk { 104 | volume_id = "${libvirt_volume.mme-data-qcow2.id}" 105 | } 106 | 107 | graphics { 108 | type = "spice" 109 | listen_type = "address" 110 | autoport = "true" 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /terraform/network_map.tfvars: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omec-project/deployment/18ae3b2d11b073b50f92ab279f61605fd22b776e/terraform/network_map.tfvars -------------------------------------------------------------------------------- /terraform/pgwc_vm.tf: -------------------------------------------------------------------------------- 1 | resource "libvirt_volume" "pgwc-qcow2" { 2 | name = "pgwc.qcow2" 3 | count = "${var.PGWC_VM_COUNT}" 4 | pool = "images" 5 | source = "${var.DISK_IMAGE_PATH}" 6 | format = "qcow2" 7 | } 8 | resource "libvirt_volume" "pgwc-data-qcow2" { 9 | name = "pgwc-data-qcow2" 10 | count = "${var.PGWC_VM_COUNT}" 11 | pool = "images" 12 | format = "qcow2" 13 | size = "${var.PGWC_DISK_SIZE}" 14 | } 15 | 16 | resource "libvirt_cloudinit" "pgwcinit" { 17 | name = "pgwcinit.iso" 18 | pool = "images" 19 | count = "${var.PGWC_VM_COUNT}" 20 | local_hostname = "pgwc" 21 | ssh_authorized_key = "${file("${var.SSH_AUTHRIZED_KEY}")}" 22 | } 23 | resource "libvirt_domain" "domain-pgwc" { 24 | name = "pgwc" 25 | memory = "${var.PGWC_MEM}" 26 | vcpu = "${var.PGWC_CPU}" 27 | cputune { 28 | cpuset = "${var.CORE_RANGE_PGWC}" 29 | } 30 | cpu { 31 | mode ="host-model" 32 | } 33 | count = "${var.PGWC_VM_COUNT}" 34 | cloudinit = "${libvirt_cloudinit.pgwcinit.id}" 35 | network_interface { 36 | hostname = "pgwc" 37 | network_name = "default" 38 | wait_for_lease = true 39 | } 40 | network_interface { 41 | addresses = ["${var.IP_S5S8_PGWC_VM_NGIC_CP2_PCI}"] 42 | passthrough = "${var.DEF_IF_S5S8_PGWC_VM_NGIC_CP2_PCI}" 43 | } 44 | network_interface { 45 | addresses = ["${var.IP_ODL_NB_VM_NGIC_CP2_PCI}"] 46 | passthrough = "${var.DEF_IF_ODL_NB_VM_NGIC_CP2_PCI}" 47 | } 48 | provisioner "local-exec" { 49 | command = "echo 'sleeping'" 50 | } 51 | provisioner "local-exec" { 52 | command = "sleep 140" 53 | } 54 | provisioner "local-exec" { 55 | command = "echo 'done sleeping'" 56 | } 57 | provisioner "file" { 58 | source = "interfaces-pgwc" 59 | destination = "/tmp/interfaces" 60 | connection { 61 | type = "ssh" 62 | user = "ubuntu" 63 | private_key = "${file("${var.PRIVATE_SSH_KEY}")}" 64 | agent = "false" 65 | } 66 | } 67 | provisioner "remote-exec" { 68 | inline = [ 69 | "sudo cp /tmp/interfaces /etc/network/interfaces", 70 | "sudo ifup ens4", 71 | "sudo ifup ens5" 72 | ] 73 | connection { 74 | type = "ssh" 75 | user = "ubuntu" 76 | private_key = "${file("${var.PRIVATE_SSH_KEY}")}" 77 | agent = "false" 78 | } 79 | } 80 | console { 81 | type = "pty" 82 | target_port = "0" 83 | target_type = "serial" 84 | } 85 | console { 86 | type = "pty" 87 | target_type = "virtio" 88 | target_port = "1" 89 | } 90 | disk { 91 | volume_id = "${libvirt_volume.pgwc-qcow2.id}" 92 | } 93 | disk { 94 | volume_id = "${libvirt_volume.pgwc-data-qcow2.id}" 95 | } 96 | 97 | graphics { 98 | type = "spice" 99 | listen_type = "address" 100 | autoport = "true" 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /terraform/pgwu_vm.tf: -------------------------------------------------------------------------------- 1 | resource "libvirt_volume" "pgwu-qcow2" { 2 | name = "pgwu.qcow2" 3 | count = "${var.PGWU_VM_COUNT}" 4 | pool = "images" 5 | source = "${var.DISK_IMAGE_PATH}" 6 | format = "qcow2" 7 | } 8 | resource "libvirt_volume" "pgwu-data-qcow2" { 9 | name = "pgwu-data-qcow2" 10 | count = "${var.PGWU_VM_COUNT}" 11 | pool = "images" 12 | format = "qcow2" 13 | size = "${var.PGWU_DISK_SIZE}" 14 | } 15 | resource "libvirt_cloudinit" "pgwuinit" { 16 | name = "pgwuinit.iso" 17 | pool = "images" 18 | count = "${var.PGWU_VM_COUNT}" 19 | local_hostname = "pgwu" 20 | ssh_authorized_key = "${file("${var.SSH_AUTHRIZED_KEY}")}" 21 | } 22 | resource "libvirt_domain" "domain-pgwu" { 23 | name = "pgwu" 24 | memory = "${var.PGWU_MEM}" 25 | vcpu = "${var.PGWU_CPU}" 26 | cputune { 27 | cpuset = "${var.CORE_RANGE_PGWU}" 28 | } 29 | cpu { 30 | mode ="host-model" 31 | } 32 | 33 | count = "${var.PGWU_VM_COUNT}" 34 | cloudinit = "${libvirt_cloudinit.pgwuinit.id}" 35 | network_interface { 36 | hostname = "pgwu" 37 | network_name = "default" 38 | wait_for_lease = true 39 | } 40 | network_interface { 41 | addresses = ["${var.IP_ODL_SB_VM_NGIC_DP2_PCI}"] 42 | passthrough = "${var.DEF_IF_ODL_SB_VM_NGIC_DP2_PCI}" 43 | } 44 | network_interface { 45 | addresses = ["${var.IP_S5S8_VM_NGIC_DP2_PCI}"] 46 | passthrough = "${var.DEF_IF_S5S8_VM_NGIC_DP2_PCI}" 47 | } 48 | hostdev { 49 | passthrough = "${var.DEF_IF_SGI_VM_NGIC_DP2_PCI}" 50 | } 51 | provisioner "local-exec" { 52 | command = "echo 'sleeping'" 53 | } 54 | provisioner "local-exec" { 55 | command = "sleep 60" 56 | } 57 | provisioner "local-exec" { 58 | command = "echo 'done sleeping'" 59 | } 60 | 61 | provisioner "file" { 62 | source = "interfaces-pgwu" 63 | destination = "/tmp/interfaces" 64 | connection { 65 | type = "ssh" 66 | user = "ubuntu" 67 | private_key = "${file("${var.PRIVATE_SSH_KEY}")}" 68 | } 69 | } 70 | provisioner "remote-exec" { 71 | inline = [ 72 | "sudo cp /tmp/interfaces /etc/network/interfaces", 73 | "sudo ifup ens4", 74 | "sudo ifup ens5" 75 | ] 76 | connection { 77 | type = "ssh" 78 | user = "ubuntu" 79 | private_key = "${file("${var.PRIVATE_SSH_KEY}")}" 80 | } 81 | } 82 | console { 83 | type = "pty" 84 | target_port = "0" 85 | target_type = "serial" 86 | } 87 | console { 88 | type = "pty" 89 | target_type = "virtio" 90 | target_port = "1" 91 | } 92 | disk { 93 | volume_id = "${libvirt_volume.pgwu-qcow2.id}" 94 | } 95 | disk { 96 | volume_id = "${libvirt_volume.pgwu-data-qcow2.id}" 97 | } 98 | 99 | graphics { 100 | type = "spice" 101 | listen_type = "address" 102 | autoport = "true" 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /terraform/sample_ngic_configurations/pgwc/cp_config.cfg: -------------------------------------------------------------------------------- 1 | NOW=$(date +"%Y-%m-%d_%H-%M") 2 | FILE="logs/cp_$NOW.log" 3 | #SPGW_CFG:: SGWC=01; PGWC=02; SPGWC=03 4 | SPGW_CFG=02 5 | S11_MME_IP=10.1.10.22 6 | S11_SGW_IP=10.1.10.20 7 | S5S8_SGWC_IP=10.5.20.51 8 | S5S8_PGWC_IP=10.5.20.61 9 | S1U_SGW_IP=11.1.1.93 10 | S5S8_SGWU_IP=12.1.1.93 11 | S5S8_PGWU_IP=14.1.1.93 12 | IP_POOL_IP=16.0.0.0 13 | IP_POOL_MASK=255.0.0.0 14 | APN=apn1 15 | MEMORY=1024 16 | -------------------------------------------------------------------------------- /terraform/sample_ngic_configurations/pgwc/interface.cfg: -------------------------------------------------------------------------------- 1 | ; Copyright (c) 2017 Intel Corporation 2 | ; 3 | ; Licensed under the Apache License, Version 2.0 (the "License"); 4 | ; you may not use this file except in compliance with the License. 5 | ; You may obtain a copy of the License at 6 | ; 7 | ; http://www.apache.org/licenses/LICENSE-2.0 8 | ; 9 | ; Unless required by applicable law or agreed to in writing, software 10 | ; distributed under the License is distributed on an "AS IS" BASIS, 11 | ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | ; See the License for the specific language governing permissions and 13 | ; limitations under the License. 14 | 15 | [0] 16 | ; please refer to INSTALL.MD for complete description of these parameters 17 | zmq_protocol = tcp 18 | 19 | ; zmq publisher and subscriber ip:port. To be configured to an available ip 20 | ; on the FPC Host. The port values are defined by the FPC Project. 21 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 22 | ; ng-core_cfg.mk 23 | zmq_sub_ip = 127.0.0.1 24 | zmq_sub_port = 5560 25 | zmq_pub_ip = 127.0.0.1 26 | zmq_pub_port = 5559 27 | 28 | ; DP and CP communication ip:port: To be configured to available ip:ports on 29 | ; the DP and CP Hosts respectively. Used for messages to communicate over UDP 30 | ; including table creation, table entries; and when DSDN_ODL_BUILD CFLAG is NOT 31 | ; defined, session establishment, modification, deletion, etc. 32 | dp_comm_ip = 192.168.125.80 33 | dp_comm_port = 20 34 | cp_comm_ip = 192.168.125.60 35 | cp_comm_port = 21 36 | 37 | ; FPC ip:port: To be configured to an available IP of FPC host. The fpc_port 38 | ; is defined by the FPC project. 39 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 40 | ; ng-core_cfg.mk 41 | fpc_ip = 192.168.125.70 42 | fpc_port = 8070 43 | fpc_topology_port = 8181 44 | 45 | ; The CP Northbound server ip:port: May be configured to any available ip:port 46 | ; on the CP Host. 47 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 48 | ; ng-core_cfg.mk 49 | cp_nb_ip = 192.168.125.61 50 | cp_nb_port = 9997 51 | -------------------------------------------------------------------------------- /terraform/sample_ngic_configurations/pgwu/dp_config.cfg: -------------------------------------------------------------------------------- 1 | NOW=$(date +"%Y-%m-%d_%H-%M") 2 | FILE="logs/dp_$NOW.log" 3 | 4 | #dp configure parameter selections 5 | #SPGW_CFG:: SGWU=01; PGWU=02; SPGWU=03 6 | # 7 | #Example configurations as per selected SPGW_CFG is given below. 8 | #Uncomment the section of parameters based on PGW_CFG configuration: 9 | # 10 | #####[SGWU]##### 11 | #SPGW_CFG=01 12 | #S1U_PORT=0000:00:08.0 13 | #S5S8_SGWU_PORT=0000:00:09.0 14 | #S1U_IP=11.3.1.93 15 | #S1U_MAC=00:00:00:00:fe:00 16 | #S5S8_SGWU_IP=12.3.1.93 17 | #S5S8_SGWU_MAC=00:00:00:00:fe:01 18 | 19 | #####[PGWU]##### 20 | SPGW_CFG=02 21 | S5S8_PGWU_PORT=0000:00:05.0 22 | SGI_PORT=0000:00:06.0 23 | S5S8_PGWU_IP=14.1.1.93 24 | S5S8_PGWU_MAC=b6:79:e0:ae:6e:0b 25 | SGI_IP=13.1.1.93 26 | SGI_MAC=02:67:9b:e2:5f:90 27 | 28 | 29 | #####[SPGWU]##### 30 | #SPGW_CFG=03 31 | #S1U_PORT=0000:00:08.0 32 | #SGI_PORT=0000:00:09.0 33 | #S1U_IP=11.3.1.93 34 | #S1U_MAC=00:00:00:00:fe:00 35 | #SGI_IP=13.3.1.93 36 | #SGI_MAC=00:00:00:00:fe:01 37 | 38 | NUM_WORKER=1 39 | MEMORY=4096 40 | 41 | #Set 1 to enabled numa, otherwise set to 0 42 | NUMA=1 43 | 44 | #Optional: 45 | #SGI_GW_IP=13.1.1.110 46 | #SGI_MASK=255.255.0.0 47 | 48 | #S1U_GW_IP=11.1.1.101 49 | #S1U_MASK=255.255.0.0 50 | -------------------------------------------------------------------------------- /terraform/sample_ngic_configurations/pgwu/interface.cfg: -------------------------------------------------------------------------------- 1 | ; Copyright (c) 2017 Intel Corporation 2 | ; 3 | ; Licensed under the Apache License, Version 2.0 (the "License"); 4 | ; you may not use this file except in compliance with the License. 5 | ; You may obtain a copy of the License at 6 | ; 7 | ; http://www.apache.org/licenses/LICENSE-2.0 8 | ; 9 | ; Unless required by applicable law or agreed to in writing, software 10 | ; distributed under the License is distributed on an "AS IS" BASIS, 11 | ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | ; See the License for the specific language governing permissions and 13 | ; limitations under the License. 14 | 15 | [0] 16 | ; please refer to INSTALL.MD for complete description of these parameters 17 | zmq_protocol = tcp 18 | 19 | ; zmq publisher and subscriber ip:port. To be configured to an available ip 20 | ; on the FPC Host. The port values are defined by the FPC Project. 21 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 22 | ; ng-core_cfg.mk 23 | zmq_sub_ip = 192.168.125.75 24 | zmq_sub_port = 5560 25 | zmq_pub_ip = 192.168.125.75 26 | zmq_pub_port = 5559 27 | 28 | ; DP and CP communication ip:port: To be configured to available ip:ports on 29 | ; the DP and CP Hosts respectively. Used for messages to communicate over UDP 30 | ; including table creation, table entries; and when DSDN_ODL_BUILD CFLAG is NOT 31 | ; defined, session establishment, modification, deletion, etc. 32 | dp_comm_ip = 192.168.125.80 33 | dp_comm_port = 20 34 | cp_comm_ip = 192.168.125.60 35 | cp_comm_port = 21 36 | 37 | ; FPC ip:port: To be configured to an available IP of FPC host. The fpc_port 38 | ; is defined by the FPC project. 39 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 40 | ; ng-core_cfg.mk 41 | fpc_ip = 192.168.125.70 42 | fpc_port = 8070 43 | fpc_topology_port = 8181 44 | 45 | ; The CP Northbound server ip:port: May be configured to any available ip:port 46 | ; on the CP Host. 47 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 48 | ; ng-core_cfg.mk 49 | cp_nb_ip = 127.0.0.1 50 | cp_nb_port = 9997 51 | -------------------------------------------------------------------------------- /terraform/sample_ngic_configurations/sgwc/cp_config.cfg: -------------------------------------------------------------------------------- 1 | NOW=$(date +"%Y-%m-%d_%H-%M") 2 | FILE="logs/cp_$NOW.log" 3 | #SPGW_CFG:: SGWC=01; PGWC=02; SPGWC=03 4 | SPGW_CFG=01 5 | S11_MME_IP=10.1.10.22 6 | S11_SGW_IP=10.1.10.20 7 | S5S8_SGWC_IP=10.5.20.51 8 | S5S8_PGWC_IP=10.5.20.61 9 | S1U_SGW_IP=11.1.1.93 10 | S5S8_SGWU_IP=12.1.1.93 11 | S5S8_PGWU_IP=14.1.1.93 12 | IP_POOL_IP=16.0.0.0 13 | IP_POOL_MASK=255.0.0.0 14 | APN=apn1 15 | MEMORY=1024 16 | -------------------------------------------------------------------------------- /terraform/sample_ngic_configurations/sgwc/interface.cfg: -------------------------------------------------------------------------------- 1 | ; Copyright (c) 2017 Intel Corporation 2 | ; 3 | ; Licensed under the Apache License, Version 2.0 (the "License"); 4 | ; you may not use this file except in compliance with the License. 5 | ; You may obtain a copy of the License at 6 | ; 7 | ; http://www.apache.org/licenses/LICENSE-2.0 8 | ; 9 | ; Unless required by applicable law or agreed to in writing, software 10 | ; distributed under the License is distributed on an "AS IS" BASIS, 11 | ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | ; See the License for the specific language governing permissions and 13 | ; limitations under the License. 14 | 15 | [0] 16 | ; please refer to INSTALL.MD for complete description of these parameters 17 | zmq_protocol = tcp 18 | 19 | ; zmq publisher and subscriber ip:port. To be configured to an available ip 20 | ; on the FPC Host. The port values are defined by the FPC Project. 21 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 22 | ; ng-core_cfg.mk 23 | zmq_sub_ip = 127.0.0.1 24 | zmq_sub_port = 5560 25 | zmq_pub_ip = 127.0.0.1 26 | zmq_pub_port = 5559 27 | 28 | ; DP and CP communication ip:port: To be configured to available ip:ports on 29 | ; the DP and CP Hosts respectively. Used for messages to communicate over UDP 30 | ; including table creation, table entries; and when DSDN_ODL_BUILD CFLAG is NOT 31 | ; defined, session establishment, modification, deletion, etc. 32 | dp_comm_ip = 192.168.125.80 33 | dp_comm_port = 20 34 | cp_comm_ip = 192.168.125.60 35 | cp_comm_port = 21 36 | 37 | ; FPC ip:port: To be configured to an available IP of FPC host. The fpc_port 38 | ; is defined by the FPC project. 39 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 40 | ; ng-core_cfg.mk 41 | fpc_ip = 192.168.125.70 42 | fpc_port = 8070 43 | fpc_topology_port = 8181 44 | 45 | ; The CP Northbound server ip:port: May be configured to any available ip:port 46 | ; on the CP Host. 47 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 48 | ; ng-core_cfg.mk 49 | cp_nb_ip = 192.168.125.60 50 | cp_nb_port = 9997 51 | -------------------------------------------------------------------------------- /terraform/sample_ngic_configurations/sgwu/cp_config.cfg: -------------------------------------------------------------------------------- 1 | NOW=$(date +"%Y-%m-%d_%H-%M") 2 | FILE="logs/cp_$NOW.log" 3 | #SPGW_CFG:: SGWC=01; PGWC=02; SPGWC=03 4 | SPGW_CFG=03 5 | S11_MME_IP=10.5.10.11 6 | S11_SGW_IP=10.5.10.41 7 | S5S8_SGWC_IP=10.5.20.51 8 | S5S8_PGWC_IP=10.5.20.61 9 | S1U_SGW_IP=11.3.1.93 10 | S5S8_SGWU_IP=12.3.1.93 11 | S5S8_PGWU_IP=14.3.1.93 12 | IP_POOL_IP=16.0.0.0 13 | IP_POOL_MASK=255.0.0.0 14 | APN=apn1 15 | MEMORY=1024 16 | -------------------------------------------------------------------------------- /terraform/sample_ngic_configurations/sgwu/dp_config.cfg: -------------------------------------------------------------------------------- 1 | NOW=$(date +"%Y-%m-%d_%H-%M") 2 | FILE="logs/dp_$NOW.log" 3 | 4 | #dp configure parameter selections 5 | #SPGW_CFG:: SGWU=01; PGWU=02; SPGWU=03 6 | # 7 | #Example configurations as per selected SPGW_CFG is given below. 8 | #Uncomment the section of parameters based on PGW_CFG configuration: 9 | # 10 | #####[SGWU]##### 11 | SPGW_CFG=01 12 | S1U_PORT=0000:00:05.0 13 | S5S8_SGWU_PORT=0000:00:06.0 14 | S1U_IP=11.1.1.93 15 | S1U_MAC=ea:c3:4f:bf:ac:a6 16 | S5S8_SGWU_IP=12.1.1.93 17 | S5S8_SGWU_MAC=c2:9c:ff:7c:2a:38 18 | 19 | #####[PGWU]##### 20 | #SPGW_CFG=02 21 | #S5S8_PGWU_PORT=0000:00:08.0 22 | #SGI_PORT=0000:00:09.0 23 | #S5S8_PGWU_IP=11.3.1.93 24 | #S5S8_PGWU_MAC=00:00:00:00:fe:00 25 | #SGI_IP=13.3.1.93 26 | #SGI_MAC=00:00:00:00:fe:01 27 | 28 | 29 | #####[SPGWU]##### 30 | #SPGW_CFG=03 31 | #S1U_PORT=0000:00:08.0 32 | #SGI_PORT=0000:00:09.0 33 | #S1U_IP=11.3.1.93 34 | #S1U_MAC=00:00:00:00:fe:00 35 | #SGI_IP=13.3.1.93 36 | #SGI_MAC=00:00:00:00:fe:01 37 | 38 | NUM_WORKER=1 39 | MEMORY=4096 40 | 41 | #Set 1 to enabled numa, otherwise set to 0 42 | NUMA=1 43 | 44 | #Optional: 45 | #SGI_GW_IP=13.1.1.110 46 | #SGI_MASK=255.255.0.0 47 | 48 | #S1U_GW_IP=11.1.1.101 49 | #S1U_MASK=255.255.0.0 50 | -------------------------------------------------------------------------------- /terraform/sample_ngic_configurations/sgwu/interface.cfg: -------------------------------------------------------------------------------- 1 | ; Copyright (c) 2017 Intel Corporation 2 | ; 3 | ; Licensed under the Apache License, Version 2.0 (the "License"); 4 | ; you may not use this file except in compliance with the License. 5 | ; You may obtain a copy of the License at 6 | ; 7 | ; http://www.apache.org/licenses/LICENSE-2.0 8 | ; 9 | ; Unless required by applicable law or agreed to in writing, software 10 | ; distributed under the License is distributed on an "AS IS" BASIS, 11 | ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | ; See the License for the specific language governing permissions and 13 | ; limitations under the License. 14 | 15 | [0] 16 | ; please refer to INSTALL.MD for complete description of these parameters 17 | zmq_protocol = tcp 18 | 19 | ; zmq publisher and subscriber ip:port. To be configured to an available ip 20 | ; on the FPC Host. The port values are defined by the FPC Project. 21 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 22 | ; ng-core_cfg.mk 23 | zmq_sub_ip = 192.168.125.75 24 | zmq_sub_port = 5560 25 | zmq_pub_ip = 192.168.125.75 26 | zmq_pub_port = 5559 27 | 28 | ; DP and CP communication ip:port: To be configured to available ip:ports on 29 | ; the DP and CP Hosts respectively. Used for messages to communicate over UDP 30 | ; including table creation, table entries; and when DSDN_ODL_BUILD CFLAG is NOT 31 | ; defined, session establishment, modification, deletion, etc. 32 | dp_comm_ip = 192.168.125.80 33 | dp_comm_port = 20 34 | cp_comm_ip = 192.168.125.60 35 | cp_comm_port = 21 36 | 37 | ; FPC ip:port: To be configured to an available IP of FPC host. The fpc_port 38 | ; is defined by the FPC project. 39 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 40 | ; ng-core_cfg.mk 41 | fpc_ip = 127.0.0.1 42 | fpc_port = 8070 43 | fpc_topology_port = 8181 44 | 45 | ; The CP Northbound server ip:port: May be configured to any available ip:port 46 | ; on the CP Host. 47 | ; These values are unused when DSDN_ODL_BUILD CFLAG not defined in 48 | ; ng-core_cfg.mk 49 | cp_nb_ip = 127.0.0.1 50 | cp_nb_port = 9997 51 | -------------------------------------------------------------------------------- /terraform/scripts/lib/ask2continue.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function ask2continue() 4 | { 5 | # 1. parameter is the question text ($1) 6 | # return status: 0 = ok, continue 7 | 8 | if [ -z "$1" ] 9 | then 10 | question="Continue ?" 11 | else 12 | question="$1" 13 | fi 14 | 15 | if [[ $DEFAULTANSWER = "-y" ]] 16 | then 17 | return 0 18 | fi 19 | read -p "$question" Answer 20 | 21 | if [[ "${Answer}" = "y" || "${Answer}" = "Y" ]] 22 | then 23 | return 0 24 | else 25 | return 1 26 | fi 27 | } 28 | -------------------------------------------------------------------------------- /terraform/scripts/lib/parseoptions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Parse options 4 | # ############################## 5 | DEFAULTANSWER="" 6 | while getopts "y" opt; do 7 | case $opt in 8 | y) 9 | #echo "-y was triggered!" >&2 10 | DEFAULTANSWER="-y" 11 | ;; 12 | \?) 13 | if [ -n "$OPTARG" ] 14 | then 15 | echo "Invalid option: \"$OPTARG\"" >&2 16 | fi 17 | ;; 18 | esac 19 | done 20 | shift $(($OPTIND - 1)) 21 | 22 | -------------------------------------------------------------------------------- /terraform/sgwc_vm.tf: -------------------------------------------------------------------------------- 1 | resource "libvirt_volume" "sgwc-qcow2" { 2 | name = "sgwc.qcow2" 3 | count = "${var.SGWC_VM_COUNT}" 4 | pool = "images" 5 | source = "${var.DISK_IMAGE_PATH}" 6 | format = "qcow2" 7 | } 8 | resource "libvirt_volume" "sgwc-data-qcow2" { 9 | name = "sgwc-data-qcow2" 10 | count = "${var.SGWC_VM_COUNT}" 11 | pool = "images" 12 | format = "qcow2" 13 | size = "${var.SGWC_DISK_SIZE}" 14 | } 15 | resource "libvirt_cloudinit" "sgwcinit" { 16 | name = "sgwcinit.iso" 17 | pool = "images" 18 | count = "${var.SGWC_VM_COUNT}" 19 | local_hostname = "sgwc" 20 | #ssh_authorized_key = "${file("/home/ubuntu/.ssh/id_rsa.pub")}" 21 | ssh_authorized_key = "${file("${var.SSH_AUTHRIZED_KEY}")}" 22 | } 23 | resource "libvirt_domain" "domain-sgwc" { 24 | name = "sgwc" 25 | memory = "${var.SGWC_MEM}" 26 | vcpu = "${var.SGWC_CPU}" 27 | cputune { 28 | cpuset = "${var.CORE_RANGE_SGWC}" 29 | } 30 | cpu { 31 | mode ="host-model" 32 | } 33 | count = "${var.SGWC_VM_COUNT}" 34 | cloudinit = "${libvirt_cloudinit.sgwcinit.id}" 35 | network_interface { 36 | hostname = "sgwc" 37 | network_name = "default" 38 | wait_for_lease = true 39 | } 40 | network_interface { 41 | addresses = ["${var.IP_S11_VM_NGIC_CP1_PCI}"] 42 | passthrough = "${var.DEF_IF_S11_VM_NGIC_CP1_PCI}" 43 | } 44 | network_interface { 45 | addresses = ["${var.IP_ODL_NB_VM_NGIC_CP1_PCI}"] 46 | passthrough = "${var.DEF_IF_ODL_NB_VM_NGIC_CP1_PCI}" 47 | } 48 | network_interface { 49 | addresses = ["${var.IP_S5S8_SGWC_VM_NGIC_CP1_PCI}"] 50 | passthrough = "${var.DEF_IF_S5S8_SGWC_VM_NGIC_CP1_PCI}" 51 | } 52 | provisioner "local-exec" { 53 | command = "echo 'sleeping'" 54 | } 55 | provisioner "local-exec" { 56 | command = "sleep 105" 57 | } 58 | provisioner "local-exec" { 59 | command = "echo 'done sleeping'" 60 | } 61 | provisioner "file" { 62 | source = "interfaces-sgwc" 63 | destination = "/tmp/interfaces" 64 | connection { 65 | type = "ssh" 66 | user = "ubuntu" 67 | private_key = "${file("${var.PRIVATE_SSH_KEY}")}" 68 | agent = "false" 69 | } 70 | } 71 | provisioner "remote-exec" { 72 | inline = [ 73 | "sudo cp /tmp/interfaces /etc/network/interfaces", 74 | "sudo ifup ens4", 75 | "sudo ifup ens5", 76 | "sudo ifup ens6" 77 | ] 78 | connection { 79 | type = "ssh" 80 | user = "ubuntu" 81 | private_key = "${file("${var.PRIVATE_SSH_KEY}")}" 82 | agent = "false" 83 | } 84 | } 85 | console { 86 | type = "pty" 87 | target_port = "0" 88 | target_type = "serial" 89 | } 90 | console { 91 | type = "pty" 92 | target_type = "virtio" 93 | target_port = "1" 94 | } 95 | disk { 96 | volume_id = "${libvirt_volume.sgwc-qcow2.id}" 97 | } 98 | disk { 99 | volume_id = "${libvirt_volume.sgwc-data-qcow2.id}" 100 | } 101 | 102 | graphics { 103 | type = "spice" 104 | listen_type = "address" 105 | autoport = "true" 106 | } 107 | } 108 | 109 | -------------------------------------------------------------------------------- /terraform/sgwu_vm.tf: -------------------------------------------------------------------------------- 1 | resource "libvirt_volume" "sgwu-qcow2" { 2 | name = "sgwu.qcow2" 3 | count = "${var.SGWU_VM_COUNT}" 4 | pool = "images" 5 | source = "${var.DISK_IMAGE_PATH}" 6 | format = "qcow2" 7 | } 8 | resource "libvirt_volume" "sgwu-data-qcow2" { 9 | name = "sgwu-data-qcow2" 10 | count = "${var.SGWU_VM_COUNT}" 11 | pool = "images" 12 | format = "qcow2" 13 | size = "${var.SGWU_DISK_SIZE}" 14 | } 15 | resource "libvirt_cloudinit" "sgwuinit" { 16 | name = "sgwuinit.iso" 17 | pool = "images" 18 | count = "${var.SGWU_VM_COUNT}" 19 | local_hostname = "sgwu" 20 | ssh_authorized_key = "${file("${var.SSH_AUTHRIZED_KEY}")}" 21 | } 22 | resource "libvirt_domain" "domain-sgwu" { 23 | name = "sgwu" 24 | memory = "${var.SGWU_MEM}" 25 | vcpu = "${var.SGWU_CPU}" 26 | cputune { 27 | cpuset = "${var.CORE_RANGE_SGWU}" 28 | } 29 | cpu { 30 | mode ="host-model" 31 | } 32 | count = "${var.SGWU_VM_COUNT}" 33 | cloudinit = "${libvirt_cloudinit.sgwuinit.id}" 34 | network_interface { 35 | hostname = "sgwu" 36 | network_name = "default" 37 | wait_for_lease = true 38 | } 39 | network_interface { 40 | addresses = ["${var.IP_ODL_SB_VM_NGIC_DP1_PCI}"] 41 | passthrough = "${var.DEF_IF_ODL_SB_VM_NGIC_DP1_PCI}" 42 | } 43 | network_interface { 44 | addresses = ["${var.IP_S5S8_VM_NGIC_DP1_PCI}"] 45 | passthrough = "${var.DEF_IF_S5S8_VM_NGIC_DP1_PCI}" 46 | } 47 | hostdev { 48 | passthrough = "${var.DEF_IF_S1U_VM_NGIC_DP1_PCI}" 49 | } 50 | 51 | provisioner "file" { 52 | source = "interfaces-sgwu" 53 | destination = "/tmp/interfaces" 54 | connection { 55 | type = "ssh" 56 | user = "ubuntu" 57 | private_key = "${file("${var.PRIVATE_SSH_KEY}")}" 58 | } 59 | } 60 | provisioner "remote-exec" { 61 | inline = [ 62 | "sudo cp /tmp/interfaces /etc/network/interfaces", 63 | "sudo ifup ens4", 64 | "sudo ifup ens5" 65 | ] 66 | connection { 67 | type = "ssh" 68 | user = "ubuntu" 69 | private_key = "${file("${var.PRIVATE_SSH_KEY}")}" 70 | } 71 | } 72 | console { 73 | type = "pty" 74 | target_port = "0" 75 | target_type = "serial" 76 | } 77 | console { 78 | type = "pty" 79 | target_type = "virtio" 80 | target_port = "1" 81 | } 82 | disk { 83 | volume_id = "${libvirt_volume.sgwu-qcow2.id}" 84 | } 85 | disk { 86 | volume_id = "${libvirt_volume.sgwu-data-qcow2.id}" 87 | } 88 | 89 | graphics { 90 | type = "spice" 91 | listen_type = "address" 92 | autoport = "true" 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /terraform/spgwc_vm.tf: -------------------------------------------------------------------------------- 1 | resource "libvirt_volume" "spgwc-qcow2" { 2 | name = "spgwc.qcow2" 3 | count = "${var.SPGWC_VM_COUNT}" 4 | pool = "images" 5 | source = "${var.DISK_IMAGE_PATH}" 6 | format = "qcow2" 7 | } 8 | resource "libvirt_volume" "spgwc-data-qcow2" { 9 | name = "spgwc-data-qcow2" 10 | count = "${var.SPGWC_VM_COUNT}" 11 | pool = "images" 12 | format = "qcow2" 13 | size = "${var.SPGWC_DISK_SIZE}" 14 | } 15 | resource "libvirt_cloudinit" "spgwcinit" { 16 | name = "spgwcinit.iso" 17 | pool = "images" 18 | count = "${var.SPGWC_VM_COUNT}" 19 | local_hostname = "spgwc" 20 | #ssh_authorized_key = "${file("/home/ubuntu/.ssh/id_rsa.pub")}" 21 | ssh_authorized_key = "${file("${var.SSH_AUTHRIZED_KEY}")}" 22 | } 23 | resource "libvirt_domain" "domain-spgwc" { 24 | name = "spgwc" 25 | memory = "${var.SPGWC_MEM}" 26 | vcpu = "${var.SPGWC_CPU}" 27 | cputune { 28 | cpuset = "${var.CORE_RANGE_SPGWC}" 29 | } 30 | cpu { 31 | mode ="host-model" 32 | } 33 | count = "${var.SPGWC_VM_COUNT}" 34 | cloudinit = "${libvirt_cloudinit.spgwcinit.id}" 35 | network_interface { 36 | hostname = "spgwc" 37 | network_name = "default" 38 | wait_for_lease = true 39 | } 40 | network_interface { 41 | addresses = ["${var.IP_S11_VM_NGIC_CP1_PCI}"] 42 | passthrough = "${var.DEF_IF_S11_VM_NGIC_CP1_PCI}" 43 | } 44 | network_interface { 45 | addresses = ["${var.IP_ODL_NB_VM_NGIC_CP1_PCI}"] 46 | passthrough = "${var.DEF_IF_ODL_NB_VM_NGIC_CP1_PCI}" 47 | } 48 | network_interface { 49 | addresses = ["${var.IP_S5S8_SGWC_VM_NGIC_CP1_PCI}"] 50 | passthrough = "${var.DEF_IF_S5S8_SGWC_VM_NGIC_CP1_PCI}" 51 | } 52 | provisioner "local-exec" { 53 | command = "echo 'sleeping'" 54 | } 55 | provisioner "local-exec" { 56 | command = "sleep 105" 57 | } 58 | provisioner "local-exec" { 59 | command = "echo 'done sleeping'" 60 | } 61 | provisioner "file" { 62 | source = "interfaces-spgwc" 63 | destination = "/tmp/interfaces" 64 | connection { 65 | type = "ssh" 66 | user = "ubuntu" 67 | private_key = "${file("${var.PRIVATE_SSH_KEY}")}" 68 | agent = "false" 69 | } 70 | } 71 | provisioner "remote-exec" { 72 | inline = [ 73 | "sudo cp /tmp/interfaces /etc/network/interfaces", 74 | "sudo ifup ens4", 75 | "sudo ifup ens5", 76 | "sudo ifup ens6" 77 | ] 78 | connection { 79 | type = "ssh" 80 | user = "ubuntu" 81 | private_key = "${file("${var.PRIVATE_SSH_KEY}")}" 82 | agent = "false" 83 | } 84 | } 85 | console { 86 | type = "pty" 87 | target_port = "0" 88 | target_type = "serial" 89 | } 90 | console { 91 | type = "pty" 92 | target_type = "virtio" 93 | target_port = "1" 94 | } 95 | disk { 96 | volume_id = "${libvirt_volume.spgwc-qcow2.id}" 97 | } 98 | disk { 99 | volume_id = "${libvirt_volume.spgwc-data-qcow2.id}" 100 | } 101 | 102 | graphics { 103 | type = "spice" 104 | listen_type = "address" 105 | autoport = "true" 106 | } 107 | } 108 | 109 | -------------------------------------------------------------------------------- /terraform/spgwu_vm.tf: -------------------------------------------------------------------------------- 1 | resource "libvirt_volume" "spgwu-qcow2" { 2 | name = "spgwu.qcow2" 3 | count = "${var.SPGWU_VM_COUNT}" 4 | pool = "images" 5 | source = "${var.DISK_IMAGE_PATH}" 6 | format = "qcow2" 7 | } 8 | resource "libvirt_volume" "spgwu-data-qcow2" { 9 | name = "spgwu-data-qcow2" 10 | count = "${var.SPGWU_VM_COUNT}" 11 | pool = "images" 12 | format = "qcow2" 13 | size = "${var.SPGWU_DISK_SIZE}" 14 | } 15 | 16 | resource "libvirt_cloudinit" "spgwuinit" { 17 | name = "spgwuinit.iso" 18 | pool = "images" 19 | count = "${var.SPGWU_VM_COUNT}" 20 | local_hostname = "spgwu" 21 | ssh_authorized_key = "${file("${var.SSH_AUTHRIZED_KEY}")}" 22 | } 23 | resource "libvirt_domain" "domain-spgwu" { 24 | name = "spgwu" 25 | memory = "${var.SPGWU_MEM}" 26 | vcpu = "${var.SPGWU_CPU}" 27 | cputune { 28 | cpuset = "${var.CORE_RANGE_SPGWU}" 29 | } 30 | cpu { 31 | mode ="host-model" 32 | } 33 | count = "${var.SPGWU_VM_COUNT}" 34 | cloudinit = "${libvirt_cloudinit.spgwuinit.id}" 35 | network_interface { 36 | hostname = "spgwu" 37 | network_name = "default" 38 | wait_for_lease = true 39 | } 40 | network_interface { 41 | addresses = ["${var.IP_ODL_SB_VM_NGIC_DP1_PCI}"] 42 | passthrough = "${var.DEF_IF_ODL_SB_VM_NGIC_DP1_PCI}" 43 | } 44 | 45 | hostdev { 46 | passthrough = "${var.DEF_IF_S1U_VM_NGIC_DP1_PCI}" 47 | } 48 | hostdev { 49 | passthrough = "${var.DEF_IF_SGI_VM_NGIC_DP2_PCI}" 50 | } 51 | 52 | 53 | provisioner "file" { 54 | source = "interfaces-spgwu" 55 | destination = "/tmp/interfaces" 56 | connection { 57 | type = "ssh" 58 | user = "ubuntu" 59 | private_key = "${file("${var.PRIVATE_SSH_KEY}")}" 60 | } 61 | } 62 | provisioner "remote-exec" { 63 | inline = [ 64 | "sudo cp /tmp/interfaces /etc/network/interfaces", 65 | "sudo ifup ens4" 66 | 67 | ] 68 | connection { 69 | type = "ssh" 70 | user = "ubuntu" 71 | private_key = "${file("${var.PRIVATE_SSH_KEY}")}" 72 | } 73 | } 74 | console { 75 | type = "pty" 76 | target_port = "0" 77 | target_type = "serial" 78 | } 79 | console { 80 | type = "pty" 81 | target_type = "virtio" 82 | target_port = "1" 83 | } 84 | disk { 85 | volume_id = "${libvirt_volume.spgwu-qcow2.id}" 86 | } 87 | disk { 88 | volume_id = "${libvirt_volume.spgwu-data-qcow2.id}" 89 | } 90 | 91 | graphics { 92 | type = "spice" 93 | listen_type = "address" 94 | autoport = "true" 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /terraform/terraform-provider-libvirt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omec-project/deployment/18ae3b2d11b073b50f92ab279f61605fd22b776e/terraform/terraform-provider-libvirt --------------------------------------------------------------------------------