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

[cfggen] Add tool to translate openconfig acl into sonic format #388

Merged
merged 7 commits into from
Mar 17, 2017

Conversation

taoyl-ms
Copy link
Contributor

@taoyl-ms taoyl-ms commented Mar 8, 2017

No description provided.

rule_props["PACKET_ACTION"] = "FORWARD"
elif rule.actions.config.forwarding_action == "DROP":
rule_props["PACKET_ACTION"] = "DROP"
elif rule.actions.config.forwarding_action == "REJECT":
Copy link
Contributor

@stcheng stcheng Mar 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm just curious what they do for the reject action. any difference from the drop? #Closed

Copy link
Contributor Author

@taoyl-ms taoyl-ms Mar 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By openconfig definition, REJECT is to "Drop the packet and send an ICMP error message to the source". We don't support ICMP error message right now, of course. #Closed

Copy link
Contributor

@stcheng stcheng Mar 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aha thanks. #Closed

@taoyl-ms taoyl-ms force-pushed the taoyl/pyangbind branch 2 times, most recently from 07cd100 to 38d19ce Compare March 10, 2017 19:30
if flag == "TCP_SYN":
tcp_flags = tcp_flags | 0x02
if flag == "TCP_FIN":
tcp_flags = tcp_flags | 0x01
Copy link
Collaborator

@lguohan lguohan Mar 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably swap the order of SYN and FIN? #Resolved

table_props = {}
table_props["policy_desc"] = table_name
table_props["type"] = "L3"
table_props["ports"] = "Ethernet0"
Copy link
Collaborator

@lguohan lguohan Mar 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this Ethernet0? #Resolved



def main():
translate(sys.argv[1])
Copy link
Collaborator

@lguohan lguohan Mar 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to translate_acl for better clarity? #Resolved


{% if docker_config_engine_debs != '' %}
Copy link
Collaborator

@lguohan lguohan Mar 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-> {% if docker_config_engine_debs.strip() -%} #Resolved

RUN dpkg -i \
{% for deb in docker_config_engine_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
{%- endfor %}
{%- endif -%}

{% if docker_config_engine_whls != '' %}
Copy link
Collaborator

@lguohan lguohan Mar 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above #Resolved

sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \
python-dev \
Copy link
Collaborator

@lguohan lguohan Mar 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also need to remove python-dev later? #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's in base image. Do we also care a lot about size here? I prefer we keep it for easier usage of pip.


In reply to: 105694773 [](ancestors = 105694773)

Copy link
Collaborator

@lguohan lguohan Mar 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we care about size since some switch only have 2G disk, what's the size we are talking about? #Resolved

rule_data["ACL_RULE_TABLE:"+table_name+":Rule_"+str(rule_idx)] = rule_props
rule_data["OP"] = "SET"

rule_props["priority"] = 10000 - rule_idx
Copy link
Collaborator

@lguohan lguohan Mar 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make 10000 as a parameter with default value, it should not be hardcoded in the code. #Resolved

elif rule.ip.config.protocol == "IP_AUTH":
rule_props["IP_PROTOCOL"] = "51"
elif rule.ip.config.protocol == "IP_L2TP":
rule_props["IP_PROTOCOL"] = "115"
Copy link
Collaborator

@lguohan lguohan Mar 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to create a map for such translation? #Resolved

print "Unknown rule action %s in table %s, rule %d!" % (rule.actions.config.forwarding_action, table_name, rule_idx)
return {}

if rule.ip.config.protocol == "":
Copy link
Collaborator

@lguohan lguohan Mar 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compare with "" does not look like a good practice. check below

http://stackoverflow.com/questions/9573244/most-elegant-way-to-check-if-the-string-is-empty-in-python #Resolved

table_data = [{}]
table_data[0]["ACL_TABLE:"+table_name] = table_props
table_data[0]["OP"] = "SET"
dump_json("table_"+table_name+".json", table_data)
Copy link
Collaborator

@lguohan lguohan Mar 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which directory do we put them into? can you add an option to specify the output directory? #Resolved

@lguohan
Copy link
Collaborator

lguohan commented Mar 13, 2017

what's the license for openconfig_acl.py? can we import the whole github instead of this one file? How do we plan to maintain this file? #Resolved

Copy link
Collaborator

@lguohan lguohan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see the comments

@taoyl-ms
Copy link
Contributor Author

taoyl-ms commented Mar 14, 2017

This file is not in openconfig github. It is an auto-generated file by pyangbind taking openconfig and ietf-config github as input. We can also rerun the generation process during every build, but I doubt if we really have the need to do that as it will quite complicate the build process.


In reply to: 286154088 [](ancestors = 286154088)

@lguohan
Copy link
Collaborator

lguohan commented Mar 14, 2017

ok, can you put comments in the file, to describe how this file is generated? #Resolved

@taoyl-ms taoyl-ms merged commit 3643281 into sonic-net:master Mar 17, 2017
stcheng pushed a commit that referenced this pull request Mar 20, 2017
…#416)

The path moved from /usr/bin/ to /usr/local/bin due to the installation change from deb to whl
lguohan added a commit to lguohan/sonic-buildimage that referenced this pull request Dec 3, 2018
* cd97c60 2018-12-03 | Add support for recreate host interfaces tap devices on warm start (sonic-net#392) [Kamil Cudnik]
* b4a7160 2018-12-03 | Drain asic queue before processing shutdown request (sonic-net#388) [Kamil Cudnik]

Signed-off-by: Guohan Lu <[email protected]>
yxieca added a commit to yxieca/sonic-buildimage that referenced this pull request Dec 5, 2018
- [warm boot] introduce command line options to warm/fast reboot scripts (sonic-net#399)
- Use -d instead of -m in config qos (sonic-net#388)

Signed-off-by: Ying Xie <[email protected]>
lguohan pushed a commit that referenced this pull request Dec 5, 2018
- [warm boot] introduce command line options to warm/fast reboot scripts (#399)
- Use -d instead of -m in config qos (#388)

Signed-off-by: Ying Xie <[email protected]>
Kalimuthu-Velappan pushed a commit to Kalimuthu-Velappan/sonic-buildimage that referenced this pull request Sep 12, 2019
madhanmellanox pushed a commit to madhanmellanox/sonic-buildimage that referenced this pull request Mar 23, 2020
dmytroxshevchuk pushed a commit to dmytroxshevchuk/sonic-buildimage that referenced this pull request Aug 31, 2020
qiluo-msft added a commit to qiluo-msft/sonic-buildimage that referenced this pull request Nov 19, 2020
Update the sonic-swss-common submodule. The following are the commits in the submodule.
```
95f9e11 2020-11-19 | [pyext] allow to catch exceptions raised in python (sonic-net#415) [Stepan Blyshchak]
5a718f9 2020-11-18 | [swig] translate C++ `del` to python `delete` (sonic-net#416) [Qi Luo]
40b255b 2020-11-12 | Fix: SWIG dict.get() should have optional default value parameter (sonic-net#413) [Qi Luo]
91e484d 2020-11-07 | Reduce notice logging (sonic-net#412) [Qi Luo]
f5945ae 2020-11-05 | Mux Cable schema definitions for interaction between linkmanager and xcvrd (sonic-net#411) [vdahiya12]
602f9c2 2020-11-05 | [lua] load lua script on demand (sonic-net#409) [Dong Zhang]
d88412b 2020-11-04 | Rename hdel to del when using multiple keys as param (sonic-net#410) [Kamil Cudnik]
e0c229a 2020-11-04 | CHASSIS_STATE_DB on control-card for chassis state (sonic-net#395) [mprabhu-nokia]
a4e3ac8 2020-11-04 | Chassisd config table to store admin state (sonic-net#388) [mprabhu-nokia]
```
qiluo-msft added a commit that referenced this pull request Nov 19, 2020
Update the sonic-swss-common submodule. The following are the commits in the submodule.
```
95f9e11 2020-11-19 | [pyext] allow to catch exceptions raised in python (#415) [Stepan Blyshchak]
5a718f9 2020-11-18 | [swig] translate C++ `del` to python `delete` (#416) [Qi Luo]
40b255b 2020-11-12 | Fix: SWIG dict.get() should have optional default value parameter (#413) [Qi Luo]
91e484d 2020-11-07 | Reduce notice logging (#412) [Qi Luo]
f5945ae 2020-11-05 | Mux Cable schema definitions for interaction between linkmanager and xcvrd (#411) [vdahiya12]
602f9c2 2020-11-05 | [lua] load lua script on demand (#409) [Dong Zhang]
d88412b 2020-11-04 | Rename hdel to del when using multiple keys as param (#410) [Kamil Cudnik]
e0c229a 2020-11-04 | CHASSIS_STATE_DB on control-card for chassis state (#395) [mprabhu-nokia]
a4e3ac8 2020-11-04 | Chassisd config table to store admin state (#388) [mprabhu-nokia]
```
santhosh-kt pushed a commit to santhosh-kt/sonic-buildimage that referenced this pull request Feb 25, 2021
Update the sonic-swss-common submodule. The following are the commits in the submodule.
```
95f9e11 2020-11-19 | [pyext] allow to catch exceptions raised in python (sonic-net#415) [Stepan Blyshchak]
5a718f9 2020-11-18 | [swig] translate C++ `del` to python `delete` (sonic-net#416) [Qi Luo]
40b255b 2020-11-12 | Fix: SWIG dict.get() should have optional default value parameter (sonic-net#413) [Qi Luo]
91e484d 2020-11-07 | Reduce notice logging (sonic-net#412) [Qi Luo]
f5945ae 2020-11-05 | Mux Cable schema definitions for interaction between linkmanager and xcvrd (sonic-net#411) [vdahiya12]
602f9c2 2020-11-05 | [lua] load lua script on demand (sonic-net#409) [Dong Zhang]
d88412b 2020-11-04 | Rename hdel to del when using multiple keys as param (sonic-net#410) [Kamil Cudnik]
e0c229a 2020-11-04 | CHASSIS_STATE_DB on control-card for chassis state (sonic-net#395) [mprabhu-nokia]
a4e3ac8 2020-11-04 | Chassisd config table to store admin state (sonic-net#388) [mprabhu-nokia]
```
mssonicbld added a commit that referenced this pull request Sep 25, 2023
… automatically (#16676)

#### Why I did it
src/sonic-platform-common
```
* c63abc0 - (HEAD -> master, origin/master, origin/HEAD) [Credo][Ycable] Remove the thread locker protection from the thread-safe APIs (#388) (21 hours ago) [Xinyu Lin]
```
#### How I did it
#### How to verify it
#### Description for the changelog
mssonicbld added a commit that referenced this pull request Nov 3, 2023
… automatically (#17084)

#### Why I did it
src/sonic-platform-common
```
* e7325db - (HEAD -> 202305, origin/202305) Fix SSD health percentage issue for vendor Virtium (#407) (#408) (11 hours ago) [Stephen Sun]
* 87e33ab - [Credo][Ycable] Remove the thread locker protection from the thread-safe APIs (#388) (11 hours ago) [Xinyu Lin]
```
#### How I did it
#### How to verify it
#### Description for the changelog
yxieca pushed a commit that referenced this pull request Dec 12, 2023
… automatically (#17451)

src/sonic-platform-common

* 39ade8d - (HEAD -> 202205, origin/202205) [Credo][Ycable] Remove the thread locker protection from the thread-safe APIs (#388) (4 days ago) [Xinyu Lin]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants