/ne-ansible-plugin

Ansible plugin for huawei datacomm products

Primary LanguagePythonOtherNOASSERTION

ne-ansible-plugin

ne-ansible-plugin is an ansible plugin which is designed for managing HUAWEI net-engine series devices, e.g ATN, NE,ME,CX routers,and also HUAWEI cloud-engine series devices, e.g CE switches.

Features:

  • provide command line plugin for managing huawei net-engine series products and cloud-engine series switches
  • provide netconf plugin for managing huawei net-engine series products and cloud-engine series switches
  • provide a common command line module
  • provide a template command line module for delivering commands in batches
  • provide a common netconf module, it will be referenced by ansible api generated by ansible-gen

Installation

1. From Code

Prerequisites

  • OS: Red Hat,Ubuntu,CentOS,OS X,BSD,Suse
  • Python: python2.6 or later (python 2.7 is preferred)/python3.x
  • Ansible: 2.6 or later, lower than 2.10

obtain code

$git clone https://github.com/HuaweiDatacomm/ne-ansible-plugin.git

execute install.sh

$cd ne-ansible-plugin
$chmod +x ./install.sh
$sh install.sh

2. From Ansible-Collection

Prerequisites

  • OS: Red Hat,Ubuntu,CentOS,OS X,BSD,Suse
  • Python: python3.6 or later (python 3.9 is preferred)/python3
  • Ansible: 2.10+ or later.

Download tarball(Off line)

wget  https://galaxy.ansible.com/download/huaweidatacom-ne-1.0.4.tar.gz
ansible-galaxy collection install huaweidatacom-ne-1.0.4.tar.gz -p /usr/local/lib/python3.9/site-packages/ansible_collections/ --force
  • note: the value of param "-p" (-p $ANSIBLE_COLLECTION_PATH)
    Use command "ansible-galaxy collection list" to get $ANSIBLE_COLLECTION_PATH
# ansible-galaxy collection list

	# /usr/local/lib/python3.9/site-packages/ansible_collections/
	Collection        Version
	----------------- -------
	ansible.netcommon 5.1.2
	ansible.utils     2.10.3
	huaweidatacom.ne  1.0.4

Installation(On line)

ansible-galaxy collection install huaweidatacom.ne

Extend ansible_builtin_runtime.yml

  • ne-module-redirection:
ne:
  redirect: huaweidatacom.ne.ne
  • find ansible_builtin_runtime.yml
    ansible_builtin_runtime.yml path = "ansible python module location" path + /config/ansible_builtin_runtime.yml
    Use command "ansible --version" to get "ansible python module location" path
# ansible --version
ansible 2.10.17
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/usr/share/ansible']
  ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
  executable location = /usr/local/lib/python3.9/bin/ansible
  python version = 3.9.2 (default, Oct 17 2021, 19:31:57) [GCC 7.3.0]
# cd /usr/local/lib/python3.9/site-packages/ansible
# find ./ -name ansible_builtin_runtime.yml
./config/ansible_builtin_runtime.yml
  • please add the ne-module-redirection under cliconf layer in ansible_builtin_runtime.yml
  • please add the ne-module-redirection under terminal layer in ansible_builtin_runtime.yml
  • please add the ne-module-redirection under netconf layer in ansible_builtin_runtime.yml
plugin_routing:
  ...
  cliconf:
    ne:
      redirect: huaweidatacom.ne.ne
    ...
  terminal:
    ne:
      redirect: huaweidatacom.ne.ne
    ...
  netconf:
    ne:
      redirect: huaweidatacom.ne.ne
    ...

Command Plugin Templates for reference(NE Modules Introduction)

Please refer to https://intl.devzone.huawei.com/en/datacom/network-element/docs/ansibleNE/ansibleNE.html?mdName=command-plugin-templates.md

Additional Resources

TBD