Coder Social home page Coder Social logo

cienasaos10ncc's Introduction

Ciena SAOS10 ncc

A simple tool to interact with Ciena SAOS 10 devices using Netconf/Yang.

Current functions implemented so far:

  • open() : Establish the connection
  • close() : Close the connection
  • get_server_capabilities() : Retrieves and stores all supported yang models.
  • get_forwarding_domains() : Returns a list of forwarding domains configured on the device
  • get_flow_points() : Returns a list of flow points configured on the device
  • get_classifiers() : Returns a list of classifiers configured on the device
  • get_g8032_rings() : Returns a list of 8032 rings and ERP instances configured on the device and their current state
  • get_ip_interfaces() : Returns a list of IP interfaces and their state from the device.
  • create_classifier() : Creates a classifier on the device
  • create_forwarding_domain() : Creates a forwarding domain on the device
  • create_flow_point() : Creates a flow point on the device
  • add_egress_transform_flow_point() : Adds an egress_l2_transform action onto a flow point
  • add_ingress_transform_flow_point() : Adds an ingress_l2_transform action onto a flow point
  • create_l3_interface() : Creates an L3 interface on the device
  • create_loopback_interface() : Creates a Loopback interface on the device
  • configure_authentication_group() : Performs all necessary configuration to build an authentication group
  • set_authentication_method() : Configures the authentication method for the device
  • enable_g8032() : Enables the G.8032 service
  • create_g8032_logicalRing() : Creates a G.8032 Logical Ring
  • create_g8032_virtualRing() : Creates a G.8032 Virtual Ring
  • create_isis_instance() : Creates an ISIS Routing Process
  • add_isis_interface() : Adds an interface into the ISIS Process
  • create_bgp_instance() : Creates a BGP instance on the device
  • add_bgp_peer() : add a BGP peer to an existing BGP Process
  • create_evpn_instance() : Creates an EVPN Instance
  • set_ethernet_segment() : Creates an EVPN Ethernet Segment
  • delete_classifier() : Deletes a classifier from the device
  • delete_flow_point() : Deletes a flow point from the device
  • delete_forwarding_domain() : Deletes a forwarding domain from the device
  • delete_g8032_logicalRing() : Deletes a G.8032 Logical Ring from the device
  • delete_g8032_virtualRing() : Deletes a G.8032 Virtual Ring from the device
  • delete_isis_instance() : Deletes an ISIS instance from the device
  • delete_isis_interface() : Remove an interface from the ISIS process
  • delete_bgp_instance() : Remove a BGP Instance from the device
  • delete_bgp_peer() : Removes a peer from a given BGP instance

Timeline

Date Release Description
07/11/2022 0.2.0 Initial Creation of pip package and initial function support.
06/29/2022 0.1.0 Initial creation of the repository and application.

Requirements

  • Python 2.7 or Python 3.5+
  • setuptools 0.6+
  • Paramiko 1.7+
  • lxml 3.3.0+
  • libxml2
  • libxslt
  • xmltodict
  • jinja2

Installation

Install my-project with pip

  unzip cienasaos10ncc.zip
  cd cienasaos10ncc
  pip install .

Usage

  import json
  from cienasaos10ncc import saos10_netconf
  
  test = saos10_netconf.SAOS10NETCONFDriver(host, user, password)
  test.open()
  print(json.dumps(test.get_classifiers(),indent=4,sort_keys=True))
  print(json.dumps(test.get_forwarding_domains(),indent=4,sort_keys=True))
  print(json.dumps(test.get_flow_points(),indent=4,sort_keys=True))
  test.close()

Authors

cienasaos10ncc's People

Contributors

lucasw-um avatar lucasw-eng avatar

Stargazers

 avatar

Watchers

 avatar

cienasaos10ncc's Issues

LDP Remote Peer

Hi,
I have add following def to the code:

	def create_ldp_remote(self, tag: "str", peer_ip: "str") -> bool:
		""" Create a remote ldp peer on SAOS10

		:param name: The name of the forwarding domain
		:param description: The description of the forwarding domain
		:param mode: One of the following (evpn-vpls, evpn-vpws, fxc, tdm-vpws, vlan, vpls, vpws)
		:return Will return True on Success and False on Failure.
		"""
		ldp_r_template = self.env.get_template("ldp_remote.xml")
		ldp_r_rendered = ldp_r_template.render(
			FD_DELETE=False,
			INSTANCE_TAG=tag,
			PEER_IP=peer_ip
		)
		print (ldp_r_rendered)
		rpc_reply = self.device.edit_config(target="running", config=ldp_r_rendered, default_operation = "merge")
		# if not self._check_response(rpc_reply, "CREATE_FORWARDING_DOMAIN"):
		# 	return False
		return True

also I add follwing xml file:

<config>
	<ldp xmlns="http://ciena.com/ns/yang/ciena/ciena-ldp">
        {%- if OPERATION_DELETE -%}
        <instance operation="delete">
        <tag> {{ INSTANCE_TAG }}</tag>
        </instance>
        {%- else -%}
        <instance>
			<tag>{{ INSTANCE_TAG }}</tag>
			<target-ldp>	
                <peers>{{ PEER_IP }}</peers>
			</target-ldp>
		</instance>
        {%- endif %}
	</ldp>
</config>

when I am calling this fuction to test. I am geeting this error:

python ciena_init.py 
<config>
        <ldp xmlns="http://ciena.com/ns/yang/ciena/ciena-ldp"><instance>
                        <tag>default</tag>
                        <target-ldp>
                <peers>10.10.10.100</peers>
                        </target-ldp>
                </instance>
        </ldp>
</config>
Traceback (most recent call last):
  File "ciena_init.py", line 10, in <module>
    test.create_ldp_remote ('default', '10.10.10.100')
  File "/home/saadzads/ciena_ncc_dev/cienasaos10ncc/cienasaos10ncc/saos10_netconf.py", line 621, in create_ldp_remote
    rpc_reply = self.device.edit_config(target="running", config=ldp_r_rendered, default_operation = "merge")
  File "/home/saadzads/ciena_ncc_dev/env/lib/python3.7/site-packages/ncclient/manager.py", line 251, in execute
    huge_tree=self._huge_tree).request(*args, **kwds)
  File "/home/saadzads/ciena_ncc_dev/env/lib/python3.7/site-packages/ncclient/operations/edit.py", line 76, in request
    return self._request(node)
  File "/home/saadzads/ciena_ncc_dev/env/lib/python3.7/site-packages/ncclient/operations/rpc.py", line 375, in _request
    raise self._reply.error
ncclient.operations.rpc.RPCError: expecting complex node type

if you can help it is really apreciated.

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.