|
8 | 8 | from xmltodict import parse
|
9 | 9 | from glob import glob
|
10 | 10 |
|
11 |
| -qos_maps_model = ['DSCP_TO_TC_MAP_LIST', |
12 |
| - 'DOT1P_TO_TC_MAP_LIST', |
13 |
| - 'TC_TO_PRIORITY_GROUP_MAP_LIST', |
14 |
| - 'TC_TO_QUEUE_MAP_LIST', |
15 |
| - 'MAP_PFC_PRIORITY_TO_QUEUE_LIST', |
16 |
| - 'PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST'] |
17 |
| - |
18 |
| -cbf_maps_model = ['DSCP_TO_FC_MAP_LIST', |
19 |
| - 'EXP_TO_FC_MAP_LIST'] |
| 11 | +Type_1_list_maps_model = ['DSCP_TO_TC_MAP_LIST', |
| 12 | + 'DOT1P_TO_TC_MAP_LIST', |
| 13 | + 'TC_TO_PRIORITY_GROUP_MAP_LIST', |
| 14 | + 'TC_TO_QUEUE_MAP_LIST', |
| 15 | + 'MAP_PFC_PRIORITY_TO_QUEUE_LIST', |
| 16 | + 'PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST', |
| 17 | + 'DSCP_TO_FC_MAP_LIST', |
| 18 | + 'EXP_TO_FC_MAP_LIST'] |
20 | 19 |
|
21 | 20 | """
|
22 | 21 | This is the Exception thrown out of all public function of this class.
|
@@ -416,15 +415,15 @@ def _yangConvert(val):
|
416 | 415 | return vValue
|
417 | 416 |
|
418 | 417 | """
|
419 |
| - Xlate a Maps list |
| 418 | + Xlate a Type 1 map list |
420 | 419 | This function will xlate from a dict in config DB to a Yang JSON list
|
421 | 420 | using yang model. Output will be go in self.xlateJson
|
422 | 421 |
|
423 | 422 | Note: Exceptions from this function are collected in exceptionList and
|
424 | 423 | are displayed only when an entry is not xlated properly from ConfigDB
|
425 | 424 | to sonic_yang.json.
|
426 | 425 |
|
427 |
| - QOS MAPS Yang has inner list, which is diffrent from config DB. |
| 426 | + Type 1 map Yang has inner list, which is diffrent from config DB. |
428 | 427 | Each field value in config db should be converted to inner list with
|
429 | 428 | key and value.
|
430 | 429 | Example:
|
@@ -468,7 +467,7 @@ def _yangConvert(val):
|
468 | 467 | }
|
469 | 468 | }
|
470 | 469 | """
|
471 |
| - def _xlateMapList(self, model, yang, config, table, exceptionList): |
| 470 | + def _xlateType1MapList(self, model, yang, config, table, exceptionList): |
472 | 471 |
|
473 | 472 | #create a dict to map each key under primary key with a dict yang model.
|
474 | 473 | #This is done to improve performance of mapping from values of TABLEs in
|
@@ -528,11 +527,11 @@ def _xlateMapList(self, model, yang, config, table, exceptionList):
|
528 | 527 | """
|
529 | 528 | def _xlateList(self, model, yang, config, table, exceptionList):
|
530 | 529 |
|
531 |
| - #Qos Map lists needs special handling because of inner yang list and |
532 |
| - #config db format. |
533 |
| - if model['@name'] in qos_maps_model or model['@name'] in cbf_maps_model: |
534 |
| - self.sysLog(msg="_xlateMapList: {}".format(model['@name'])) |
535 |
| - self._xlateMapList(model, yang, config, table, exceptionList) |
| 530 | + # Type 1 lists need special handling because of inner yang list and |
| 531 | + # config db format. |
| 532 | + if model['@name'] in Type_1_list_maps_model: |
| 533 | + self.sysLog(msg="_xlateType1MapList: {}".format(model['@name'])) |
| 534 | + self._xlateType1MapList(model, yang, config, table, exceptionList) |
536 | 535 | return
|
537 | 536 |
|
538 | 537 | #create a dict to map each key under primary key with a dict yang model.
|
@@ -747,7 +746,7 @@ def _revYangConvert(val):
|
747 | 746 |
|
748 | 747 | """
|
749 | 748 | Rev xlate from <TABLE>_LIST to table in config DB
|
750 |
| - QOS MAP Yang has inner list, each inner list key:val should |
| 749 | + Type 1 MAPs Yang has inner list, each inner list key:val should |
751 | 750 | be mapped to field:value in Config DB.
|
752 | 751 | Example:
|
753 | 752 |
|
@@ -791,7 +790,7 @@ def _revYangConvert(val):
|
791 | 790 | }
|
792 | 791 | """
|
793 | 792 |
|
794 |
| - def _revMapXlateList(self, model, yang, config, table): |
| 793 | + def _revXlateType1MapList(self, model, yang, config, table): |
795 | 794 | # get keys from YANG model list itself
|
796 | 795 | listKeys = model['key']['@value']
|
797 | 796 | # create a dict to map each key under primary key with a dict yang model.
|
@@ -828,9 +827,9 @@ def _revMapXlateList(self, model, yang, config, table):
|
828 | 827 | """
|
829 | 828 | def _revXlateList(self, model, yang, config, table):
|
830 | 829 |
|
831 |
| - # special processing for QOS Map table. |
832 |
| - if model['@name'] in qos_maps_model or model['@name'] in cbf_maps_model: |
833 |
| - self._revMapXlateList(model, yang, config, table) |
| 830 | + # special processing for Type 1 Map tables. |
| 831 | + if model['@name'] in Type_1_list_maps_model: |
| 832 | + self._revXlateType1MapList(model, yang, config, table) |
834 | 833 | return
|
835 | 834 |
|
836 | 835 | # get keys from YANG model list itself
|
|
0 commit comments