Giter Club home page Giter Club logo

osslm-ansible-resource-manager's Introduction

ALM Resource Manager for Ansible

For a more detailed overview and context of this project reference the opensource service lifecycle management project

This project provides a resource manager (RM) for the IBM Agile Lifecycle Manager (ALM) based on ansible (see https://www.ansible.com/ ).

It uses a plain out-of-the-box ansible, ie. not ansible-tower, so no REST APIs are available. The ALM-RM API is built using swagger 2.0, and the python-flask server code generator.

It implements the ALM Resource Manager v1.1.2 API Specification and supports sync (REST) as well as async (kafka) mode of operations. The resource packages are expected to be in a folder on the shared file system. Requests, locations and instances are persisted in a cassandra db. It is tested against ALM v1.2 and v2.0

The current architecture: ansible resource manager architecture

This resource manager is packaged in two docker containers managed by docker-compose.

  • container running ansible 2, python3 and the swagger server
  • container running cassandra 3

Folders for logging, keys and resources are shared with the host. You should find them in <install_dir>/var_alm_ansible_rm/driver/

Pre-reqs

  • docker version >= 17.06.0-ce
  • docker-compose version >= 1.14.0

The images have been tested on MacOS 10.12 and ubuntu xenial

Installation

The steps to install this resource manager are described here.

Tests

There is a set of pytest tests that run most of the REST API. To run them

  • run docker-compose up -d
  • cd into the tests folder
  • install the python dependencies: pip install -r test_requirements.txt
  • run the tests with: pytest . -v

hello-world

There is an example hello-world resource to test and explore a run-through

  • from initiating a transition request
  • running an ansible playbook
  • returning id and properties from the playbook
  • checking the request
  • checking the resource instance

Add Locations

  • run the "create or update a deployment location" operation

Here is an example of location properties for an openstack tenant:

{
"auth_pwd": "mypass",
"auth_url": "http://osserver:35357/v2.0",
"auth_user": "admin",
"project": "admin"
}

This resource manager also supports the openstack python openstack client config files for details. To use client config:

  1. Name you config file: clouds.yaml
  2. Put it in the var_alm_ansible_rm/driver/clouds folder
  3. add a property "cloud: cloud_name" to your location. The cloud_name MUST be defined in your clouds.yaml file
  4. Usage in your ansible os_... tasks
os_server:
      cloud:  {{ cloud }}
      name: ...

All location properties are passed to your ansible playbooks. So the location properties you need to specify depend on your ansible playbooks (e.g. how you connect to the openstack region). If your playbook connects to locations other than an openstack, just add all required properties to the location properties.

Logs etc

The shared file system exposes these directories:

var_alm_ansible_rm/cassandra - all cassandra files
var_alm_ansible_rm/driver
   /logs  - the driver log files
   /resources - put your component packages here
   /keys - keypairs created by the playbooks
   /licenses - license files for VNFs
   /libraries - 3rd party ansible modules
   /clouds - the cloud.yaml file to capture openstack cloud credentials

ansible Playbooks and Roles

There is a set of requirements that need to be implemented in your ansible playbooks and roles so that this resource manager can successfully run these playbooks.

osslm-ansible-resource-manager's People

Contributors

dependabot[bot] avatar imgbot[bot] avatar joschkappel avatar kant avatar mmeroberts avatar rmolloyibm avatar sglover avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

osslm-ansible-resource-manager's Issues

references: openstack networks

Current implementation allows to reference openstack networks by name using resource::ans_network::1.0.
However this only returns the network uuid.

It is required to get access to subnet name, id , gw and cidr of a referenced network.
Current assumption/limitation: 1 networks contains exactly 1 subnet.

A new resource: openstack-network is available. This can ONLY be used as reference and returns:

  • id (of the network)
  • name (of the network)
  • subnet_name
  • subnet_id
  • subnet_gw
  • subnet_cidr

ETSI-SOL003 support

The ETSI-SOL003 NVFO-VNFM interfaces require the ALM-RM to act as a server as well as a client to the S-VNFM.
Current RM implemenattion is missing

  • OAuth2 flows to allow the S-VNFM to authenticate
  • APIs to receive notifications from the S-VNFM
  • APIs to subscribe to notifications
  • APIs to receive grant requests from the S-VNFM

VNF resource package onboarding

The current version requires access to the host file system to upload VNF packages.
A REST api to upload a .csar archive with would be much easier to handle.

The RM would

  • extract the archive
  • validate mandatory folders and files
  • check correct yaml descriptors

internal properties persistence

Allow playbooks to create new resource instance properties and persistently store those for each instance.
For all transition requests store all properties in the instance table.

This enables the resource manager to keep state and other data throughout the instance lifecycle.

docker-compose build fails

new directory naming causes the docker-compose to fail:
docker-compose -f alm-ansible-rm-docker-compose.yml build
ERROR: build path /Users/jkappel/MyApplications/osslm-ansible-adaptor/alm-ansible-driver either does not exist, is not accessible, or is not a valid URL.
need to adapt scripts to new folder structure

support the new metric section in the transisiton request

see latest RM specification v1.1.1 section 2.7 'publishing metrics' and 2.4.1 'create resource transistion'

Requirements:

  • support the metricKey in the transition request
  • persist metricKey in instance inventory
  • run a "cron" job that gets metrics from VNFs and publishes them on to asm_load or asm_integrity topic ??

Log rotation fails

Running flask in multi process mode ( fix #52 ) introduces log rotation issues.
Essentially log rotation fails. Random processes will still write to the old log. As file handling is not sequentialized.

missing resource properies for operations

the transition requests from ALM for lifecycle operations ( anything other than install,configure, start,stop,uninstall) contain ONLY the properties/parameters for the specific operation (defined in the property section of the operation. This means that the resource properties (that are defined in the properties section of the resource descriptor) are missing for these requests.

The RM needs to get these properties from the database and add them to the ansible playbook call.

Use ALM metric_key as resource_id

ALM requires the resource manager to create a unique ID for each resource during the initial "INSTALL" transition request.
The current ansible-rm implementation defers the creation of this ID to the ansible playbook of each resource (see Resource Id ).

By now ALM itself creates a unique ID for each resource, the "metric_key". This is passed from ALM to RM in every transition request.
This change will eliminate the need to add a debug message to create RESOURCE_IDs to every playbook.
Instead the core RM code will simply create a resource id by using the metric_key.

Propagate request id to the playbooks

Add the request id to the properties (variables) taht are available to the ansible playbooks.
This is required for the enhancements to support ETSI SOL003 in later commit.

vmware support

the vmware defaull plugins require additional python modules (eg PyVmomi).
These need to added to the requirement.txt so they become part of the setup

rename default kafka topic

kafak topic defaults to "docker-rm".
should be "ansible-rm".
Should be fixed in default config.yml file

resource manager internal resource properties

Ability to handle instance properties that are

  • defined and created during playbook execution
    • use "INTERNAL_PROPERTIES" to report these new values
  • persistenly stored and available for every lifecycle operation

This allows to handle instance state information that spans lifecycle states.
For example a "Stop" playbook can create a property "state":"stopped"
Another playbook (e.g. "Start") can use this information.

openstack server creation fails

using os_server with
nics:

  • port-id:

fails with : "msg": "Additional unsupported keys given for server network creation: dict_keys(['port-id'])"}
Seems to be a bug in shade v 1.22.
solution: upgrade to shade 1.24.0

Uninstall fo resource with no properties fails

Need to take into account property-less resources...
Fails when trying to get the instance:

File "/usr/src/app/swagger_server/controllers/ans_requests.py", line 86, in start_request
lc_props, lc_intprops = InstanceHandler( self.resType, self.resVer, self.transitionRequest.deployment_location ).get_instance_properties( self.transitionRequest.metric_key )
TypeError: 'NoneType' object is not iterable

add support for 3rd party ansible modules

for some VNF lifecycle operations we require specific ansible modules.
These should be added w/out need to re-create the ansible container.

  • add a /library fodler to the shared volumes that will hold the 3rd party modules
  • add this folder to the /etc/ansible.cfg so that ansible is aware

support ansible openstack cloud files

current implementation only supports passing openstack auth properties as explicite parameters in the plays.
To enhance reusability and limit dependency on vairous openstack auth options the resource manager should support cloud confg files.
Auth information is driven by os-client-config, which means that values can come from a yaml config file in /etc/ansible/openstack.yaml, /etc/openstack/clouds.yaml or ~/.config/openstack/clouds.yaml.

It is required as part of the CRUD for deployment location also manage the cloud config file.
With this play can simply use "cloud: cloud-name" to use any type fo auth scheme.

map source volume to ease development

create a shared volume that maps the sources to the in container /usr/src/app folder. This will allow code changes w/out the need to re-build the container.
Eases dev and testing.

f5 support

Add support to manage f5 devices using the ansible plug-in.
Add missing pre-requisite libraries to requirements.txt:
f5-sdk
bigsuds
netaddr
deepdiff

cassandra should be shared by multiple RM istances

remove and dependency on the ansible RM from the cassandra setup.
get the cassandra cluster from an environment variable
in the docker-compose file set the cassandra cluster variable for the ansible container
this enables sharing the DB by varous RMs instances (eg the OSM rm)

Provide an API to retrieve deployment location properties

The Application LIfecycle Manager API to get deployment location details only supports name and type.
We need to add an API to retrieve the properties of a deployment location

Proposal:
GET /topology/deployment-locations/properties
and
GET /topology/deployment-locations/{id}/properties

junos support

Add support for playbooks that make use of the Juniper.junos roles to manage junos devices

PaloAlto Networks support

Add required libraries to enable the PAN-OS core ansible modules.
This enbales all ansible network modules that manage a PaloAlto vFW.

requests for resource instance fails

the requests

  • get /topology/instances/{id}
  • get /topology/deployment-locations/{name}/instances

return a 500 status code if the resource instance does not have any properties.

Support VNF package folder structure

Adjust layout of the resources folder to the VNF package structure:

  • resource descriptor in descriptor/ folder
  • playbooks and roles in lifecycle/ folder
  • config files in config/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.