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

Added template for Huawei SmartAX: display_ont_port_vlan_0_1_byport_eth_0 #1796

Conversation

evilmonkey19
Copy link
Contributor

The idea with the extra empty empty value is to capture the native_vlan and other values that cannot be capture. I am open to any suggestion on how to improve.

@jmcgill298
Copy link
Contributor

The idea with the extra empty empty value is to capture the native_vlan and other values that cannot be capture. I am open to any suggestion on how to improve.

@evilmonkey19 what do you mean by extra empty value, and by values that cannot be captured?

@evilmonkey19
Copy link
Contributor Author

If you look at the .yml file you will notice that the "native_vlan" value is fulfilled only once. I do this because of the output. I get the values from the list and the extra values (native_vlan and so on) are filled in an another value.

@jmcgill298
Copy link
Contributor

If you look at the .yml file you will notice that the "native_vlan" value is fulfilled only once. I do this because of the output. I get the values from the list and the extra values (native_vlan and so on) are filled in an another value.

Oh, I think you are looking for Fillup:

Value Fillup NATIVE_VLAN (...)

@evilmonkey19
Copy link
Contributor Author

I have tried before but unfortunately i didn't make it work and I had no clue on how to make it work :'(
This is the template:

Value PORT_ID (\d+)
Value PORT_TYPE (\S+)
Value C_VLAN (\d+)
Value C_PRI (\d+)
Value ETH_TYPE (\S+)
Value VLAN_TYPE (\S+)
Value S_VLAN (\d+)
Value S_PRI (\d+)
Value S_PRI_POLICY (\S+)
Value Fillup NATIVE_VLAN (\d+)
Value Fillup DEFAULT_PRIORITY (\d+)
Value Fillup DOWNSTREAM_MODE (\S+)
Value Fillup MISMATCH_POLICY (\S+)

Start
  ^\s*Port\s*Port\s*C-VLAN\s*C-PRI\s*ETH-type\s*VLAN-type\s*S-VLAN\s*S-PRI\s*S-PRI\s*
  ^\s*type\s*ID\s*POLICY
  ^\s+${PORT_TYPE}\s+${PORT_ID}\s+(-|${C_VLAN})\s+(-|${C_PRI})\s+(-|${ETH_TYPE})\s+(-|${VLAN_TYPE})\s+(-|${S_VLAN})\s*(-|${S_PRI})\s*(-|${S_PRI_POLICY})\s* -> Record
  ^\s*Native\s*VLAN\s*:\s*${NATIVE_VLAN}\s*
  ^\s*Default\s*priority\s*:\s*${DEFAULT_PRIORITY}\s*
  ^\s*Downstream\s*mode\s*:\s*${DOWNSTREAM_MODE}\s*
  ^\s*Mismatch\s*policy\s*:\s*${MISMATCH_POLICY}\s*
  ^\s*
  ^. -> Error

@jmcgill298
Copy link
Contributor

I sent a PR evilmonkey19#1 that passes tests for me

@evilmonkey19
Copy link
Contributor Author

evilmonkey19 commented Jul 30, 2024

I see! It works as expected but again it adds 3 values to the list instead of only 2, although the list is only 2 rows. To me, it looks even better your solution 😃. I gotta say that Huawei made this case hard xD

@jmcgill298
Copy link
Contributor

Oh, the additional entry can also be fixed

@jmcgill298 jmcgill298 merged commit 9dc7f14 into networktocode:master Jul 30, 2024
14 checks passed
@jmcgill298
Copy link
Contributor

@evilmonkey19 there are two ways to solve that, either overriding the default behavior of EOF -> Record with just EOF to exclude the Record, or making one of the the capture groups Required so that the EOF->Record doesn't have a qualified entry to record

@evilmonkey19
Copy link
Contributor Author

Awesome! Thanks for letting me know ❤️ It was the first time for me with this kind of templates

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

Successfully merging this pull request may close these issues.

2 participants