Skip to content

Commit

Permalink
Add Keysight LoadCore Agent Component (#43)
Browse files Browse the repository at this point in the history
* tn_init bastion can modify its networks again

* Reunify IaC between tn_init and tn_bastion and tn_vxlan

* Develop (#38)

* Loadcore agent (#24)

* Add Keysight LoadCore Agent Component

* Delete Middleware IP as input variable

* Nokia xrext uma (#25)

* Add Nokia XRext Component

* Initial release of the 6G Library XRext component

* Removed “input_file.yaml”, the only required file is "sample_input_file.yaml"

* Updates to TN_DEPLOY and TN_DESTROY

* Merged last changes in .global from main branch

* Merge last changes in '.global' from branch 'v0.2.2' of https://github.com/6G-SANDBOX/6G-Library into nokia_xrext_uma

* Merge last changes in 'tn_init', 'tn_vxlan' and 'tn_bastion' from branch 'v0.2.2' of https://github.com/6G-SANDBOX/6G-Library into nokia_xrext_uma

* Debugging config files

* Debugging config files

* Remove references to site_jenkins_* variables

* Variable tn_ssh_public_key renamed succesfully in the rest of the components

* Debugging config files

* Add Nokia XRext Component

* Initial release of the 6G Library XRext component

* Removed “input_file.yaml”, the only required file is "sample_input_file.yaml"

* Updates to TN_DEPLOY and TN_DESTROY from v0.2.2

* Merged last changes in .global from main branch

* Merge last changes in '.global' from branch 'v0.2.2' of https://github.com/6G-SANDBOX/6G-Library into nokia_xrext_uma

* Debugging config files

* Debugging config files

* Remove references to site_jenkins_* variables

* Variable tn_ssh_public_key renamed succesfully in the rest of the components

* Debugging config files

* Remove references to site_jenkins_* variables

---------

Co-authored-by: joaquin <[email protected]>
Co-authored-by: Álvaro Curto Merino <[email protected]>

* Campaign manager client (#26)

* Initial untested draft

* Update README.md

Better layout

* Update README.md

* Naming cleaned up

* Reworked to use ansible modules instead of shell commands

* Getting image from site packages reference as recommended. Will need site access before i can actually create the image

---------

Co-authored-by: Torsten Iversen <[email protected]>
Co-authored-by: TorstenIversen <[email protected]>

* Fokus open5gcore (#27)

* Initial WIP import of the Open5Gcore component

* add ip and vm id to output remove ref to oneKE

---------

Co-authored-by: Bjoern Riemer <[email protected]>

* Opensand (#28)

* Initial Commit of OpenSAND component

* Initial Commit of OpenSAND Component

---------

Co-authored-by: theonidou <[email protected]>
Co-authored-by: confragkos <[email protected]>

* Upf p4 sw (#29)

* Added UPF-P4 SW component. WIP

* Added UPF-P4 config files

* Modified public.yaml file

* Changed name file to fix bug

* Fixed name issue

* Fixed bug in upf_p4_install.yaml

* Changed mongodb-clients packet for mongosh packet for compatibility

* Fixed and Testing indentation

* Testing

* More testing...

* Changed struct upf_p4_install.yaml

* Used include_task instead of include

* Fixed become permissions

* Add become permission to install apk packets

* Removed mongosh installation

* Testing to ensure variable availability

* Testing variables availability

* More Testing

* More Testing

* More Testing...

* Delegate facts true

* Testing to send vars between stages with different hosts

* Testing to fix synchronize issue

* Changed module synchronize for copy

* Testing..

* Testing 2..

* Testing persist variables between different hosts

* Using hostvars and Testing

* Changed permissions when config folder is copied

* Fixed bug in copy module

* Fixed copy config folder

* Working on the outputs and the execution results

* Fixed bug in outputs name

---------

Co-authored-by: rafagarciaUMA <[email protected]>

* Open5gs vm (#30)

* Initial WIP import of the Open5Gcore component

* add ip and vm id to output remove ref to oneKE

* VM version of Open5GS; WIP

* update component name for open5gs vm

* fix variable names for componnets

* fix variable name

---------

Co-authored-by: Bjoern Riemer <[email protected]>

* Ntn backhaul (#31)

* Add NTN backhaul component

* Add ericsson_radio files (#32)

Adding the initialization files for enabling Athens site's ericsson radio

Co-authored-by: George P. <[email protected]>

* V0.2.2 (#33)

* tn_init bastion can modify its networks again

* Reunify IaC between tn_init and tn_bastion and tn_vxlan

* V0.2.2 (#34)

* tn_init bastion can modify its networks again

* Reunify IaC between tn_init and tn_bastion and tn_vxlan

* Trailing

* Changelog

* ocf quickfix

* Fix private variable ocf (#35)

* tn_init bastion can modify its networks again

* Reunify IaC between tn_init and tn_bastion and tn_vxlan

* Minor fix and readme completion

---------

Co-authored-by: Jorge Moratinos Salcines <[email protected]>

* tnuser login fix

* fix component name in readme

* Change sample_input_file in ocf to avoid confusion

* ocf component tnlcm descriptor uploaded (#36)

* Trying to fix VM instantiation

* Add ELCM component (#37)

* First version ELCM component

* Minor change

* Quickfix

* Minor change

* Uncomment private variables

* Add elcm component to changelog

* Remove broken component

* Wait for OneKE VMs

* Remove v0.2.2 references

---------

Co-authored-by: Jesus Macias Portela <[email protected]>
Co-authored-by: joaquin <[email protected]>
Co-authored-by: Torsten Iversen <[email protected]>
Co-authored-by: TorstenIversen <[email protected]>
Co-authored-by: Bjoern Riemer <[email protected]>
Co-authored-by: theonidou <[email protected]>
Co-authored-by: confragkos <[email protected]>
Co-authored-by: rafagarciaUMA <[email protected]>
Co-authored-by: George P. <[email protected]>
Co-authored-by: Jorge Moratinos Salcines <[email protected]>
Co-authored-by: Jorge Moratinos <[email protected]>
Co-authored-by: Carlos Andreo <[email protected]>

* Quickfix

* Changelog ortography

* Ks8500 runner (#39)

* added

* Commented out some debug

* Documentation fixes

* Add Keysight LoadCore Agent Component (#42)

* Add Keysight LoadCore Agent Component

* Delete Middleware IP as input variable

* Rebase loadcore_agent with changes from develop (#41)

* Loadcore agent (#24)

* Add Keysight LoadCore Agent Component

* Delete Middleware IP as input variable

* Nokia xrext uma (#25)

* Add Nokia XRext Component

* Initial release of the 6G Library XRext component

* Removed “input_file.yaml”, the only required file is "sample_input_file.yaml"

* Updates to TN_DEPLOY and TN_DESTROY

* Merged last changes in .global from main branch

* Merge last changes in '.global' from branch 'v0.2.2' of https://github.com/6G-SANDBOX/6G-Library into nokia_xrext_uma

* Merge last changes in 'tn_init', 'tn_vxlan' and 'tn_bastion' from branch 'v0.2.2' of https://github.com/6G-SANDBOX/6G-Library into nokia_xrext_uma

* Debugging config files

* Debugging config files

* Remove references to site_jenkins_* variables

* Variable tn_ssh_public_key renamed succesfully in the rest of the components

* Debugging config files

* Add Nokia XRext Component

* Initial release of the 6G Library XRext component

* Removed “input_file.yaml”, the only required file is "sample_input_file.yaml"

* Updates to TN_DEPLOY and TN_DESTROY from v0.2.2

* Merged last changes in .global from main branch

* Merge last changes in '.global' from branch 'v0.2.2' of https://github.com/6G-SANDBOX/6G-Library into nokia_xrext_uma

* Debugging config files

* Debugging config files

* Remove references to site_jenkins_* variables

* Variable tn_ssh_public_key renamed succesfully in the rest of the components

* Debugging config files

* Remove references to site_jenkins_* variables

---------

Co-authored-by: joaquin <[email protected]>
Co-authored-by: Álvaro Curto Merino <[email protected]>

* Campaign manager client (#26)

* Initial untested draft

* Update README.md

Better layout

* Update README.md

* Naming cleaned up

* Reworked to use ansible modules instead of shell commands

* Getting image from site packages reference as recommended. Will need site access before i can actually create the image

---------

Co-authored-by: Torsten Iversen <[email protected]>
Co-authored-by: TorstenIversen <[email protected]>

* Fokus open5gcore (#27)

* Initial WIP import of the Open5Gcore component

* add ip and vm id to output remove ref to oneKE

---------

Co-authored-by: Bjoern Riemer <[email protected]>

* Opensand (#28)

* Initial Commit of OpenSAND component

* Initial Commit of OpenSAND Component

---------

Co-authored-by: theonidou <[email protected]>
Co-authored-by: confragkos <[email protected]>

* Upf p4 sw (#29)

* Added UPF-P4 SW component. WIP

* Added UPF-P4 config files

* Modified public.yaml file

* Changed name file to fix bug

* Fixed name issue

* Fixed bug in upf_p4_install.yaml

* Changed mongodb-clients packet for mongosh packet for compatibility

* Fixed and Testing indentation

* Testing

* More testing...

* Changed struct upf_p4_install.yaml

* Used include_task instead of include

* Fixed become permissions

* Add become permission to install apk packets

* Removed mongosh installation

* Testing to ensure variable availability

* Testing variables availability

* More Testing

* More Testing

* More Testing...

* Delegate facts true

* Testing to send vars between stages with different hosts

* Testing to fix synchronize issue

* Changed module synchronize for copy

* Testing..

* Testing 2..

* Testing persist variables between different hosts

* Using hostvars and Testing

* Changed permissions when config folder is copied

* Fixed bug in copy module

* Fixed copy config folder

* Working on the outputs and the execution results

* Fixed bug in outputs name

---------

Co-authored-by: rafagarciaUMA <[email protected]>

* Open5gs vm (#30)

* Initial WIP import of the Open5Gcore component

* add ip and vm id to output remove ref to oneKE

* VM version of Open5GS; WIP

* update component name for open5gs vm

* fix variable names for componnets

* fix variable name

---------

Co-authored-by: Bjoern Riemer <[email protected]>

* Ntn backhaul (#31)

* Add NTN backhaul component

* Add ericsson_radio files (#32)

Adding the initialization files for enabling Athens site's ericsson radio

Co-authored-by: George P. <[email protected]>

* V0.2.2 (#33)

* tn_init bastion can modify its networks again

* Reunify IaC between tn_init and tn_bastion and tn_vxlan

* V0.2.2 (#34)

* tn_init bastion can modify its networks again

* Reunify IaC between tn_init and tn_bastion and tn_vxlan

* Trailing

* Changelog

* ocf quickfix

* Fix private variable ocf (#35)

* tn_init bastion can modify its networks again

* Reunify IaC between tn_init and tn_bastion and tn_vxlan

* Minor fix and readme completion

---------

Co-authored-by: Jorge Moratinos Salcines <[email protected]>

* tnuser login fix

* fix component name in readme

* Change sample_input_file in ocf to avoid confusion

* ocf component tnlcm descriptor uploaded (#36)

* Trying to fix VM instantiation

* Add ELCM component (#37)

* First version ELCM component

* Minor change

* Quickfix

* Minor change

* Uncomment private variables

* Add elcm component to changelog

* Remove broken component

* Wait for OneKE VMs

* Remove v0.2.2 references

* Quickfix

* Minor changes

* Minor changes

* Add opensand components on develop branch.

* Change Username variable on .tf.j2 files

* Remove SSH_PUBLIC_KEY from .tf.j2 files

* Change ssh_public_key on ansible.builtin.set_fact

* FIx errors

* Fix ansible_ssh_common_args and ansible_user

* Fix user errors on Stage 3

* Change tn user name

* Ks8500 runner (#39)

* added

* Commented out some debug

* tn_init bastion can modify its networks again (#40)

* tn_init bastion can modify its networks again

* Reunify IaC between tn_init and tn_bastion and tn_vxlan

* Develop (#38)

* Loadcore agent (#24)

* Add Keysight LoadCore Agent Component

* Delete Middleware IP as input variable

* Nokia xrext uma (#25)

* Add Nokia XRext Component

* Initial release of the 6G Library XRext component

* Removed “input_file.yaml”, the only required file is "sample_input_file.yaml"

* Updates to TN_DEPLOY and TN_DESTROY

* Merged last changes in .global from main branch

* Merge last changes in '.global' from branch 'v0.2.2' of https://github.com/6G-SANDBOX/6G-Library into nokia_xrext_uma

* Merge last changes in 'tn_init', 'tn_vxlan' and 'tn_bastion' from branch 'v0.2.2' of https://github.com/6G-SANDBOX/6G-Library into nokia_xrext_uma

* Debugging config files

* Debugging config files

* Remove references to site_jenkins_* variables

* Variable tn_ssh_public_key renamed succesfully in the rest of the components

* Debugging config files

* Add Nokia XRext Component

* Initial release of the 6G Library XRext component

* Removed “input_file.yaml”, the only required file is "sample_input_file.yaml"

* Updates to TN_DEPLOY and TN_DESTROY from v0.2.2

* Merged last changes in .global from main branch

* Merge last changes in '.global' from branch 'v0.2.2' of https://github.com/6G-SANDBOX/6G-Library into nokia_xrext_uma

* Debugging config files

* Debugging config files

* Remove references to site_jenkins_* variables

* Variable tn_ssh_public_key renamed succesfully in the rest of the components

* Debugging config files

* Remove references to site_jenkins_* variables

---------

Co-authored-by: joaquin <[email protected]>
Co-authored-by: Álvaro Curto Merino <[email protected]>

* Campaign manager client (#26)

* Initial untested draft

* Update README.md

Better layout

* Update README.md

* Naming cleaned up

* Reworked to use ansible modules instead of shell commands

* Getting image from site packages reference as recommended. Will need site access before i can actually create the image

---------

Co-authored-by: Torsten Iversen <[email protected]>
Co-authored-by: TorstenIversen <[email protected]>

* Fokus open5gcore (#27)

* Initial WIP import of the Open5Gcore component

* add ip and vm id to output remove ref to oneKE

---------

Co-authored-by: Bjoern Riemer <[email protected]>

* Opensand (#28)

* Initial Commit of OpenSAND component

* Initial Commit of OpenSAND Component

---------

Co-authored-by: theonidou <[email protected]>
Co-authored-by: confragkos <[email protected]>

* Upf p4 sw (#29)

* Added UPF-P4 SW component. WIP

* Added UPF-P4 config files

* Modified public.yaml file

* Changed name file to fix bug

* Fixed name issue

* Fixed bug in upf_p4_install.yaml

* Changed mongodb-clients packet for mongosh packet for compatibility

* Fixed and Testing indentation

* Testing

* More testing...

* Changed struct upf_p4_install.yaml

* Used include_task instead of include

* Fixed become permissions

* Add become permission to install apk packets

* Removed mongosh installation

* Testing to ensure variable availability

* Testing variables availability

* More Testing

* More Testing

* More Testing...

* Delegate facts true

* Testing to send vars between stages with different hosts

* Testing to fix synchronize issue

* Changed module synchronize for copy

* Testing..

* Testing 2..

* Testing persist variables between different hosts

* Using hostvars and Testing

* Changed permissions when config folder is copied

* Fixed bug in copy module

* Fixed copy config folder

* Working on the outputs and the execution results

* Fixed bug in outputs name

---------

Co-authored-by: rafagarciaUMA <[email protected]>

* Open5gs vm (#30)

* Initial WIP import of the Open5Gcore component

* add ip and vm id to output remove ref to oneKE

* VM version of Open5GS; WIP

* update component name for open5gs vm

* fix variable names for componnets

* fix variable name

---------

Co-authored-by: Bjoern Riemer <[email protected]>

* Ntn backhaul (#31)

* Add NTN backhaul component

* Add ericsson_radio files (#32)

Adding the initialization files for enabling Athens site's ericsson radio

Co-authored-by: George P. <[email protected]>

* V0.2.2 (#33)

* tn_init bastion can modify its networks again

* Reunify IaC between tn_init and tn_bastion and tn_vxlan

* V0.2.2 (#34)

* tn_init bastion can modify its networks again

* Reunify IaC between tn_init and tn_bastion and tn_vxlan

* Trailing

* Changelog

* ocf quickfix

* Fix private variable ocf (#35)

* tn_init bastion can modify its networks again

* Reunify IaC between tn_init and tn_bastion and tn_vxlan

* Minor fix and readme completion

---------

Co-authored-by: Jorge Moratinos Salcines <[email protected]>

* tnuser login fix

* fix component name in readme

* Change sample_input_file in ocf to avoid confusion

* ocf component tnlcm descriptor uploaded (#36)

* Trying to fix VM instantiation

* Add ELCM component (#37)

* First version ELCM component

* Minor change

* Quickfix

* Minor change

* Uncomment private variables

* Add elcm component to changelog

* Remove broken component

* Wait for OneKE VMs

* Remove v0.2.2 references

---------

Co-authored-by: Jesus Macias Portela <[email protected]>
Co-authored-by: joaquin <[email protected]>
Co-authored-by: Torsten Iversen <[email protected]>
Co-authored-by: TorstenIversen <[email protected]>
Co-authored-by: Bjoern Riemer <[email protected]>
Co-authored-by: theonidou <[email protected]>
Co-authored-by: confragkos <[email protected]>
Co-authored-by: rafagarciaUMA <[email protected]>
Co-authored-by: George P. <[email protected]>
Co-authored-by: Jorge Moratinos Salcines <[email protected]>
Co-authored-by: Jorge Moratinos <[email protected]>
Co-authored-by: Carlos Andreo <[email protected]>

* Quickfix

* Changelog ortography

* Ks8500 runner (#39)

* added

* Commented out some debug

* Documentation fixes

---------

Co-authored-by: Jesus Macias Portela <[email protected]>
Co-authored-by: joaquin <[email protected]>
Co-authored-by: Torsten Iversen <[email protected]>
Co-authored-by: TorstenIversen <[email protected]>
Co-authored-by: Bjoern Riemer <[email protected]>
Co-authored-by: theonidou <[email protected]>
Co-authored-by: confragkos <[email protected]>
Co-authored-by: rafagarciaUMA <[email protected]>
Co-authored-by: George P. <[email protected]>
Co-authored-by: Jorge Moratinos Salcines <[email protected]>
Co-authored-by: Jorge Moratinos <[email protected]>
Co-authored-by: Carlos Andreo <[email protected]>
Co-authored-by: Carlos Andreo <[email protected]>

---------

Co-authored-by: Jesus Macias Portela <[email protected]>
Co-authored-by: joaquin <[email protected]>
Co-authored-by: Torsten Iversen <[email protected]>
Co-authored-by: TorstenIversen <[email protected]>
Co-authored-by: Bjoern Riemer <[email protected]>
Co-authored-by: theonidou <[email protected]>
Co-authored-by: confragkos <[email protected]>
Co-authored-by: rafagarciaUMA <[email protected]>
Co-authored-by: George P. <[email protected]>
Co-authored-by: Jorge Moratinos Salcines <[email protected]>
Co-authored-by: Jorge Moratinos <[email protected]>
Co-authored-by: Carlos Andreo <[email protected]>
Co-authored-by: Carlos Andreo <[email protected]>
Co-authored-by: confragkos <[email protected]>

---------

Co-authored-by: Jesus Macias Portela <[email protected]>
Co-authored-by: joaquin <[email protected]>
Co-authored-by: Torsten Iversen <[email protected]>
Co-authored-by: TorstenIversen <[email protected]>
Co-authored-by: Bjoern Riemer <[email protected]>
Co-authored-by: theonidou <[email protected]>
Co-authored-by: confragkos <[email protected]>
Co-authored-by: rafagarciaUMA <[email protected]>
Co-authored-by: George P. <[email protected]>
Co-authored-by: Jorge Moratinos Salcines <[email protected]>
Co-authored-by: Jorge Moratinos <[email protected]>
Co-authored-by: Carlos Andreo <[email protected]>
Co-authored-by: Carlos Andreo <[email protected]>
Co-authored-by: confragkos <[email protected]>

---------

Co-authored-by: Jesus Macias Portela <[email protected]>
Co-authored-by: joaquin <[email protected]>
Co-authored-by: Torsten Iversen <[email protected]>
Co-authored-by: TorstenIversen <[email protected]>
Co-authored-by: Bjoern Riemer <[email protected]>
Co-authored-by: theonidou <[email protected]>
Co-authored-by: confragkos <[email protected]>
Co-authored-by: rafagarciaUMA <[email protected]>
Co-authored-by: George P. <[email protected]>
Co-authored-by: Jorge Moratinos Salcines <[email protected]>
Co-authored-by: Jorge Moratinos <[email protected]>
Co-authored-by: Carlos Andreo <[email protected]>
Co-authored-by: Carlos Andreo <[email protected]>
Co-authored-by: confragkos <[email protected]>
  • Loading branch information
15 people authored Oct 9, 2024
1 parent 01bf357 commit c41a7fc
Show file tree
Hide file tree
Showing 11 changed files with 313 additions and 0 deletions.
62 changes: 62 additions & 0 deletions loadcore_agent/.tnlcm/public.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
######################################################
##
## Component public variables
##
## Variables accesible to the experimenter.
##
## They are contained inside 3 global variables
## with all required info:
##
## 1. metadata: General information like mantainers,
## component dependencies and allowed platforms
##
## 2. input: Customizable variables for each
## deployment to be filled by the experimenter
## or the TNLCM
##
## 3. output: Values sent to the TNLCM callback to
## keep track of the TN deployments
##
######################################################


####################################
## Component metadata
####################################
metadata:
maintainers:
- Jesus Macias Portela <[email protected]>
- Ana Isabel Lara García <[email protected]>
- Álvaro Curto Merino <[email protected]>
- Filip Ivanovich <[email protected]>
- Abhishek Bakshi <[email protected]>
short_description: Keysight LoadCore Agent
long_description: |
A vm machine with Keysight LoadCore Agent ready to play.
With the variable "one_loadcore_middleware_ip", you need to specify the IP address where the LoadCore Middleware is listening.
After booting, the agent register itself with the LoadCore Middleware server.
hypervisors: [one]

####################################
## Component input
####################################
input:
one_loadcore_agent_networks:
description: Ordered list of Virtual Network names the VM will be part of.
type: "list[vnet]"
default_value: ["vnet"]
required_when: true

####################################
## Component output
####################################
output:
ips: "Dictionary of VM addresses: key='VNet ID in OpenNebula', value='the IP address'"
id: VM ID in OpenNebula

####################################
## Site-specific variables
####################################
site_variables:
template_id: ID of the LoadCore VM template to use in your OpenNebula environment
image_id: ID of the LoadCore image to use in your OpenNebula environment
7 changes: 7 additions & 0 deletions loadcore_agent/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# loadcore_agent

A vm machine with Keysight LoadCore agent ready to play
With the variable "one_loadcore_middleware_ip", you need to specify the IP address where the LoadCore Middleware is listening.
After booting, the agent register itself with the LoadCore Middleware server.


35 changes: 35 additions & 0 deletions loadcore_agent/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Changelog

## [v0.2.2] - 2024-09-16
### Added
- New component loadcore_agent

<!-- Change latest version value at every release -->
[v0.2.2]: https://github.com/6G-SANDBOX/6G-Library/compare/v0.1.0...v0.2.2

<!-- FIELDS PER VERSION -->
<!--
### Added
- New features
### Changed
- Changes in existing functionality
### Deprecated
- Soon-to-be removed features
### Removed
- Removed features
### Fixed
- Bug fixes
### Security
- Vulnerability warnings
-->
117 changes: 117 additions & 0 deletions loadcore_agent/code/component_playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
---
- name: "STAGE 1: Apply IAC to deploy the component"
hosts: localhost
gather_facts: false
connection: local
tasks:
- name: Load enviromental variables from different sources
ansible.builtin.include_tasks: "{{ workspace }}/.global/cac/load_variables.yaml"

- name: Prepare terraform working directory
ansible.builtin.include_tasks: "{{ workspace }}/.global/cac/terraform_workdir.yaml"

- name: Terraform apply
ansible.builtin.include_tasks: "{{ workspace }}/.global/cac/terraform_apply.yaml"


- name: "STAGE 2: Prepare to access the component"
hosts: localhost
gather_facts: false
connection: local
tasks:
- name: Retrieve terraform outputs
ansible.builtin.shell:
args:
chdir: "{{ workspace }}/.terraform/"
cmd: "set -o pipefail && terraform output --json | jq 'with_entries(.value |= .value)'"
executable: /bin/bash
register: terraform_outputs
changed_when: false

- name: Set Terraform outputs as playbook facts
ansible.builtin.set_fact:
bastion_ip: "{{ (terraform_outputs.stdout | from_json)['tn_bastion-ips'][site_networks_id.default | string] }}"
tn_ssh_public_key: "{{ (terraform_outputs.stdout | from_json)['tn_ssh_public_key'] }}"
ips: "{{ (terraform_outputs.stdout | from_json)[entity_name + '-ips'] }}"
id: "{{ (terraform_outputs.stdout | from_json)[entity_name + '-id'] }}"
vnet_id: "{{ (terraform_outputs.stdout | from_json)[one_loadcore_agent_networks[0] + '-id'] | string}}"

- name: Add new VM to Ansible Inventory
ansible.builtin.add_host:
hostname: "{{ entity_name }}"
ansible_host: "{{ ips[ vnet_id ] }}"
ansible_ssh_common_args: "-J jenkins@{{ bastion_ip }}"
ansible_user: jenkins

- name: Create SSH config file in the Jenkins-master for debugging purposes
ansible.builtin.include_tasks: "{{ workspace }}/{{ component_type }}/code/{{ site_hypervisor }}/cac/01_pre/ssh_config.yaml"


- name: "STAGE 3: Apply CAC to prepare the component"
hosts: "{{ hostvars['localhost']['entity_name'] }}"
gather_facts: false
tasks:
- name: Wait for system to become reachable
ansible.builtin.wait_for_connection:
connect_timeout: 5
timeout: 200

- name: Set site ssh key as authorized in jenkins user
ansible.posix.authorized_key:
user: jenkins
state: present
key: "{{ item }}"
loop:
- "{{ hostvars['localhost'].get('site_admin_ssh_public_key', '') }}"
when: item != ''

- name: Create new user for experimenter access
become: true
ansible.builtin.user:
name: tnuser
shell: /bin/bash
groups: sudo

- name: Set TN ssh key as authorized in new user
become: true
ansible.posix.authorized_key:
user: tnuser
state: present
key: "{{ item }}"
loop:
- "{{ hostvars['localhost']['tn_ssh_public_key'] }}"

- name: Copy file with owner and permissions
become: true
ansible.builtin.copy:
src: /home/ixia/agent-setup.sh
dest: /home/tnuser/agent-setup.sh
owner: tnuser
group: tnuser
mode: '0644'

- name: Execute bash script to register the Agent with the Middleware
become: true
shell: "/home/tnuser/agent-setup.sh {{ loadcore_middleware_ip }} management_interface=ens3 test_interface=ens4 reboot_api_enabled=y update_hostname=n"
args:
chdir: "/home/tnuser/"
register: result

- name: Verify result
assert:
that:
- result.rc == 0
fail_msg: "There was a problem registering LoadCore Agent"
success_msg: "LoadCore Agent should be registered correctly"

- name: "STAGE 4: Publish execution results"
hosts: localhost
gather_facts: false
connection: local
tasks:
- name: Publish execution results to TNLCM
ansible.builtin.include_tasks: "{{ workspace }}/.global/cac/publish_ok_results.yaml"
vars:
output:
ips: "{{ ips | b64encode }}"
id: "{{ id | b64encode }}"
9 changes: 9 additions & 0 deletions loadcore_agent/code/one/cac/01_pre/ssh_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- name: Append new commponent's name and IP into a .ssh/config.d/ file
community.general.ssh_config:
host: "{{ tn_id }}-{{ entity_name }}"
hostname: "{{ ips[vnet_id] | default('ERROR_ASSIGNING_IP') }}"
proxyjump: "{{ tn_id }}-tn_bastion"
remote_user: "jekins"
ssh_config_file: "/var/lib/jenkins/.ssh/config.d/{{ tn_id }}"
state: present
4 changes: 4 additions & 0 deletions loadcore_agent/code/one/cac/01_pre/vm_resources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
- name: Overwrite again with explicit values from the input file
ansible.builtin.include_vars:
file: "{{ workspace }}/{{ component_type }}/variables/input_file.yaml"
33 changes: 33 additions & 0 deletions loadcore_agent/code/one/iac/loadcore_agent.tf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# https://registry.terraform.io/providers/OpenNebula/opennebula/latest/docs/resources/virtual_machine
# https://docs.opennebula.io/6.8/management_and_operations/references/template.html#context-section
resource "opennebula_virtual_machine" "{{ entity_name }}" {
name = "{{ tn_id }}-{{ entity_name }}"
template_id = {{ site_available_components.loadcore_agent.template_id }}
cpu = {{ one_loadcore_agent_cpu }}
vcpu = {{ one_loadcore_agent_cpu }}
memory = {{ one_loadcore_agent_memory }}

context = {
NETWORK = "YES"
SET_HOSTNAME = "$NAME"
USERNAME = "jenkins"
}

{% for network in one_loadcore_agent_networks %}
nic {
model = "virtio"
network_id = opennebula_virtual_network.{{ network }}.id
}
{% endfor %}

}

output "{{ entity_name }}-id" {
description = "OpenNebula VM ID"
value = opennebula_virtual_machine.{{ entity_name }}.id
}

output "{{ entity_name }}-ips" {
description = "OpenNebula VM Network Assignments"
value = { for nic in opennebula_virtual_machine.{{ entity_name }}.nic[*] : nic.network_id => nic.computed_ip }
}
5 changes: 5 additions & 0 deletions loadcore_agent/result_templates/fail_result.md.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
There was an error. Detailed info:

```
{{ terraform_apply.stderr }}
```
21 changes: 21 additions & 0 deletions loadcore_agent/result_templates/ok_result.md.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# {{ tn_id }}-{{ entity_name}}

The component `{{ tn_id }}-{{ entity_name }}` has been succesfully created.

<p align="center">
<img src="https://www.keysight.com/content/dam/keysight/en/img/other/video-thumbnails/LoadCore-Our-Answer-to-5G-Core-Challenges.jpeg" width="600" title="LOADCORE">
</a>
</p>

It consists of an LoadCore Agent Virtual Machine

## Important information:

- **OpenNebula VM ID**: `{{ id }}`
- **VM memory**: `{{ one_loadcore_agent_memory}} MiB`
- **VM VCPUs**: `{{ one_loadcore_agent_cpu }}`
- **VM available storage**: `25 GiB`
- **VM network interfaces**:
```json
{{ ips }}
```
7 changes: 7 additions & 0 deletions loadcore_agent/sample_input_file.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# THIS IS AN INPUT FILE EXAMPLE. Values may not be valid for your enviroment

#This is a list of network ids. Each entry means a network interface attached to this network.
one_loadcore_agent_networks:
- "vnet_1"
- "vnet_2"
- "vnet_3"
13 changes: 13 additions & 0 deletions loadcore_agent/variables/one/private.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
######################################################
##
## Component private variables
##
## Variables required for the deployment
## and their default value.
## Some of them are modifiable through input variables
##
######################################################

one_loadcore_agent_cpu: 4
one_loadcore_agent_memory: 8192
one_loadcore_agent_disk: 25600

0 comments on commit c41a7fc

Please sign in to comment.