@@ -419,6 +419,7 @@ class ModuleDocFragment(object):
419419 - INFO
420420 - DEBUG
421421
422+
422423'''
423424
424425 # _SUB_CONNECT_DOCUMENTATION is just _CONNECT_DOCUMENTATION with each
@@ -582,6 +583,8 @@ class ModuleDocFragment(object):
582583 'replace' , 'override' , 'overwrite' ]
583584# Supported configuration modes
584585CONFIG_MODE_CHOICES = ['exclusive' , 'private' ]
586+ # Supported configuration models
587+ CONFIG_MODEL_CHOICES = ['openconfig' , 'custom' , 'ietf' , 'True' ]
585588
586589
587590def convert_to_bool_func (arg ):
@@ -1409,7 +1412,8 @@ def close_configuration(self):
14091412 (str (ex )))
14101413
14111414 def get_configuration (self , database = 'committed' , format = 'text' ,
1412- options = {}, filter = None ):
1415+ options = {}, filter = None , model = None ,
1416+ namespace = None , remove_ns = True ):
14131417 """Return the device configuration in the specified format.
14141418
14151419 Return the database device configuration database in the format format.
@@ -1457,7 +1461,10 @@ def get_configuration(self, database='committed', format='text',
14571461 config = None
14581462 try :
14591463 config = self .dev .rpc .get_config (options = options ,
1460- filter_xml = filter )
1464+ filter_xml = filter ,
1465+ model = model ,
1466+ remove_ns = remove_ns ,
1467+ namespace = namespace )
14611468 self .logger .debug ("Configuration retrieved." )
14621469 except (self .pyez_exception .RpcError ,
14631470 self .pyez_exception .ConnectError ) as ex :
@@ -1469,7 +1476,7 @@ def get_configuration(self, database='committed', format='text',
14691476 if not isinstance (config , self .etree ._Element ):
14701477 self .fail_json (msg = 'Unexpected configuration type returned. '
14711478 'Configuration is: %s' % (str (config )))
1472- if config .tag != 'configuration-text' :
1479+ if model is None and config .tag != 'configuration-text' :
14731480 self .fail_json (msg = 'Unexpected XML tag returned. '
14741481 'Configuration is: %s' %
14751482 (etree .tostring (config , pretty_print = True )))
@@ -1478,7 +1485,7 @@ def get_configuration(self, database='committed', format='text',
14781485 if not isinstance (config , self .etree ._Element ):
14791486 self .fail_json (msg = 'Unexpected configuration type returned. '
14801487 'Configuration is: %s' % (str (config )))
1481- if config .tag != 'configuration-set' :
1488+ if model is None and config .tag != 'configuration-set' :
14821489 self .fail_json (msg = 'Unexpected XML tag returned. '
14831490 'Configuration is: %s' %
14841491 (etree .tostring (config , pretty_print = True )))
@@ -1487,7 +1494,7 @@ def get_configuration(self, database='committed', format='text',
14871494 if not isinstance (config , self .etree ._Element ):
14881495 self .fail_json (msg = 'Unexpected configuration type returned. '
14891496 'Configuration is: %s' % (str (config )))
1490- if config .tag != 'configuration' :
1497+ if model is None and config .tag != 'configuration' :
14911498 self .fail_json (msg = 'Unexpected XML tag returned. '
14921499 'Configuration is: %s' %
14931500 (etree .tostring (config , pretty_print = True )))
0 commit comments