Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Future Parser Support List #86

Open
3 of 8 tasks
jeffkala opened this issue Dec 9, 2021 · 7 comments
Open
3 of 8 tasks

Future Parser Support List #86

jeffkala opened this issue Dec 9, 2021 · 7 comments

Comments

@jeffkala
Copy link
Collaborator

jeffkala commented Dec 9, 2021

List of Parser that should be created.

  • IOS-XR
  • Aruba
  • Checkpoint
  • A10
  • NetScaler
  • Netscreen
  • Palo Alto
  • Huawei
@jdrew82
Copy link
Contributor

jdrew82 commented Jun 16, 2022

A few more to add:
-Moved to top comment-

@angely-dev
Copy link

Any updates on Huawei parser?

Huawei config is a BaseSpaceConfigParser with:

  • comment_chars as #
  • banner_start as header login information
  • A banner starts and ends with "

A one-line banner:

[device]header login information "My one-line banner"

A multi-line banner:

[device]header login information "
The banner text supports 480 characters max, including the start and the end character.If you want to enter more than this, use banner file instead.Input banner text, and quit with the character '"':
==============================
My multi-line banner
==============================
"

A sample config file:

#
interface GigabitEthernet0/0/4
 undo portswitch
 undo shutdown
 l2 binding vsi CUST
#
interface GigabitEthernet0/0/5
 undo portswitch
 undo shutdown
 l2 binding vsi CUST
#
bgp 34177
 router-id 1.1.1.1
 ipv4-family vpn-instance ADMIN
  import-route static
#
header login information "==============================
My multi-line banner
==============================
"
#

Is this enough for you to implement it, or do you prefer a PR?

Thanks!

@itdependsnetworks
Copy link
Contributor

PR would be best, can see some hints here: https://netutils.readthedocs.io/en/latest/dev/dev_config/#new-parsers

@angely-dev
Copy link

Thanks @itdependsnetworks.

So using this simple snippet:

# netutils/config/parser.py

class HuaweiVRPConfigParser(BaseSpaceConfigParser):
    """Huawei VRP implementation of ConfigParser Class."""

    comment_chars: t.List[str] = ["#"]
    banner_start = ["header login information"]
    banner_end = '"'

I got this diff output:

interface GigabitEthernet0/0/2
 l2 binding vsi CUST
header login information "==================================================
my multi-line banner
==================================================^C

The banner end delimiter " gets replaced by ^C. It is done by the generic space config parser #L215. Is this normal behavior? I can override the _build_banner method but I doubt this is the guideline.

@itdependsnetworks
Copy link
Contributor

I do not know know, what is banner end meant to be? you show an output (not the original) that would make it seem like ^C is the proper end, but not really clear to me.

@angely-dev
Copy link

Sorry, that wasn't so clear. The original command is:

header login information "==================================================
my multi-line banner
=================================================="

The last " denotes the end of the banner. When I call diff_network_config, I got the previous output:

header login information "==================================================
my multi-line banner
==================================================^C

The last " gets replaced by ^C by _build_banner.normalise_delimiter_caret_c which is part of the BaseSpaceConfigParser. So this is made on purpose obviously but I don't know why.

@itdependsnetworks
Copy link
Contributor

Probably best to ask on slack, so can be a bit more real time in convo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants