Conversation
…ven-devops/nso-oc-services into oc_to_xe_qos_class_map
| # OpenConfig System | ||
| xe_system_program_service(oc_self, nso_props) | ||
|
|
||
| <<<<<<< HEAD |
| # OpenConfig QoS | ||
| if nso_props.service.oc_qos__qos: | ||
| xe_qos_program_service(oc_self, nso_props) | ||
| ======= |
There was a problem hiding this comment.
Do we need to remove this?
# OpenConfig QoS
if nso_props.service.oc_qos__qos:
xe_qos_program_service(oc_self, nso_props)
| device.ios__ntp.trusted_key.delete() | ||
| device.ios__router.bgp.delete() | ||
| device.ios__router.ospf.delete() | ||
| >>>>>>> main |
|
Please remove the "env" folder |
| @@ -0,0 +1,280 @@ | |||
| # -*- mode: python; python-indent: 4 -*- | |||
| from translation.openconfig_xe.common import xe_system_get_interface_ip_address | |||
There was a problem hiding this comment.
xe_system_get_interface_ip_address isn't used in the file
|
Add lines to xr_main.py and nx_main.py to raise errors if OC QoS configurations are sent for XR and NX devices. |
| "openconfig-qos:conditions": { | ||
| "openconfig-qos:ipv4": { | ||
| "openconfig-qos:config": { | ||
| "openconfig-qos:dscp": modify_dscp(class_map["match"]["ip"]["dscp"]), |
There was a problem hiding this comment.
function modify_dscp returns a list. "openconfig-qos:dscp" should be a string
| "openconfig-qos:conditions": { | ||
| "openconfig-qos:ipv4": { | ||
| "openconfig-qos:config": { | ||
| "openconfig-qos:dscp": modify_dscp(class_map["match"]["dscp"]) |
There was a problem hiding this comment.
function modify_dscp returns a list. "openconfig-qos:dscp" should be a string
| device_cdb.ios__class_map.create(c_map.name) | ||
| for t_map in c_map.terms.term: | ||
| pmap_cmap[t_map.actions.config.target_group] = c_map.name | ||
| # Configure "match ip dscp" |
There was a problem hiding this comment.
"ip dscp" or "dscp" (for IPv4 and IPv6) should be based on the c_map.type. The c_map.type will determine the availability of "t_map.conditions.[ ipv4, ipv6, etc...]"
There was a problem hiding this comment.
Do you mean:
if type: ETHERNET ---> use 'dscp'
if type: IPv4 ---> use 'ip dscp'
or something else?
There was a problem hiding this comment.
In this code:
for c_map in nso_props.service.oc_qos__qos.classifiers.classifier:
pmap_cmap = {}
# Configure class-map
if device_cdb.ios__class_map.exists(c_map.name) and c_map.name != 'class-default':
del device_cdb.ios__class_map[c_map.name]
elif c_map.name == 'class-default':
for t_map in c_map.terms.term:
pmap_cmap[t_map.actions.config.target_group] = c_map.name
else:
device_cdb.ios__class_map.create(c_map.name)
for t_map in c_map.terms.term:
pmap_cmap[t_map.actions.config.target_group] = c_map.name
# Configure "match ip dscp"
if t_map.conditions.ipv4.config.protocol == 4:
# Configure multiple dscp statements
if t_map.conditions.ipv4.config.dscp_set:
The code is already looking into IPv4 terms (if t_map.conditions.ipv4.config.protocol == 4:) to determine if the term is using IPv4, but the term could be IPv6. For instance if c_map.type == "IPv6" (or something like that), then the term would be t_map.conditions.ipv6....
Added QoS checks on NX-OS and IOS-XR.
Fixed modify_dscp function.
7887a97 to
1c63db8
Compare
| if "cir" in cd_new_police: | ||
| cir = cd_new_police["cir"] | ||
|
|
||
| return cir |
| if "bc" in cd_new_police: | ||
| bc = cd_new_police["bc"] | ||
|
|
||
| return bc |
| if "pir" in cd_new_police: | ||
| pir = cd_new_police["pir"] | ||
|
|
||
| return pir |
| if "pir-be" in cd_new_police and "be" in cd_new_police["pir-be"]: | ||
| be = cd_new_police["pir-be"]["be"] | ||
|
|
||
| return be |
| if "cir" in cm_new_police: | ||
| cir = cm_new_police["cir"] | ||
|
|
||
| return cir |
| if "bc" in cm_new_police: | ||
| bc = cm_new_police["bc"] | ||
|
|
||
| return bc |
| if "pir" in cm_new_police: | ||
| pir = cm_new_police["pir"] | ||
|
|
||
| return pir |
| if "pir-be" in cm_new_police and "be" in cm_new_police["pir-be"]: | ||
| be = cm_new_police["pir-be"]["be"] | ||
|
|
||
| return be |
| }, | ||
| "openconfig-qos:two-rate-three-color": { | ||
| "openconfig-qos:config": { | ||
| "openconfig-qos:cir": set_qos_cir_percent(cm_new_percent), |
| "openconfig-qos:config": { | ||
| "openconfig-qos:cir": set_qos_cir_percent(cm_new_percent), | ||
| "openconfig-qos:bc": set_qos_bc_percent(cm_new_percent), | ||
| "openconfig-qos:pir": set_qos_pir_percent(cm_new_percent), |
|
|
||
| openconfig_class_map.append({ | ||
| "openconfig-qos:name": "class-default", | ||
| "openconfig-qos:config": {"openconfig-qos:name:": "class-default"}, |
| if len(class_map["match"]["ip"]["dscp"]) == 1: | ||
| openconfig_class_map.append({ | ||
| "openconfig-qos:name": class_map["name"], | ||
| "openconfig-qos:config": {"openconfig-qos:name:": class_map["name"], |
| openconfig_class_map.append({ | ||
| "openconfig-qos:name": class_map["name"], | ||
| "openconfig-qos:config": {"openconfig-qos:name:": class_map["name"], | ||
| "openconfig-qos:type:": "IPV4"}, |
| openconfig_class_map.append({ | ||
| "openconfig-qos:name": class_map["name"], | ||
| "openconfig-qos:config": {"openconfig-qos:name:": class_map["name"], | ||
| "openconfig-qos:type:": "IPV4"}, |
| elif len(class_map["match"]["ip"]["dscp"]) > 1: | ||
| openconfig_class_map.append({ | ||
| "openconfig-qos:name": class_map["name"], | ||
| "openconfig-qos:config": {"openconfig-qos:name:": class_map["name"], |
| if len(class_map["match"]["dscp"]) == 1: | ||
| openconfig_class_map.append({ | ||
| "openconfig-qos:name": class_map["name"], | ||
| "openconfig-qos:config": {"openconfig-qos:name:": class_map["name"] |
| elif len(class_map["match"]["dscp"]) > 1: | ||
| openconfig_class_map.append({ | ||
| "openconfig-qos:name": class_map["name"], | ||
| "openconfig-qos:config": {"openconfig-qos:name:": class_map["name"] |
| openconfig-qos:ipv4: | ||
| openconfig-qos:config: | ||
| openconfig-qos:dscp-set: | ||
| - '13' |
| openconfig-qos:config: | ||
| openconfig-qos:dscp-set: | ||
| - '13' | ||
| - '15' |
| }, | ||
| "openconfig-qos:one-rate-two-color": { | ||
| "openconfig-qos:config": { | ||
| "openconfig-qos:cir": policy_map["class-default"]["class"][0]["priority"]["kilo-bits"], |
| }, | ||
| "openconfig-qos:one-rate-two-color": { | ||
| "openconfig-qos:config": { | ||
| "openconfig-qos:cir": class_name["priority"]["kilo-bits"], |
|
|
||
| # Openconfig QoS | ||
| if is_qos_configured(nso_props): | ||
| raise NotImplementedError('openconfig-qos has not yet been implemented for XR') |
| return violate_percent, drop | ||
|
|
||
|
|
||
| def set_qos_interface(config_leftover, openconfig_interface, interface, interface_list, intf_to_sched_list, openconfig_scheduler): |
There was a problem hiding this comment.
Only interfaces with QoS policies should be added here. This is adding all.
New feat: XE to OC QoS