Skip to content

Commit 2672ccc

Browse files
authored
Merge pull request #81 from IBM/dl-route-reports
feat: direct link route report updates
2 parents 2694282 + e569dd7 commit 2672ccc

File tree

3 files changed

+422
-103
lines changed

3 files changed

+422
-103
lines changed

ibm_cloud_networking_services/direct_link_v1.py

Lines changed: 177 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7283,6 +7283,10 @@ class RouteReport():
72837283
"""
72847284
route report.
72857285
7286+
:attr List[RouteReportAdvertisedRoute] advertised_routes: (optional) Array of
7287+
connection prefixes advertised to the on-prem network. This parameter is not
7288+
returned when the route report was generated prior to inclusion of this
7289+
parameter.
72867290
:attr datetime created_at: Date and time route report was requested.
72877291
:attr List[RouteReportRoute] gateway_routes: Array of local/direct routes.
72887292
:attr str id: Report identifier.
@@ -7307,6 +7311,7 @@ def __init__(self,
73077311
status: str,
73087312
virtual_connection_routes: List['RouteReportConnection'],
73097313
*,
7314+
advertised_routes: List['RouteReportAdvertisedRoute'] = None,
73107315
updated_at: datetime = None) -> None:
73117316
"""
73127317
Initialize a RouteReport object.
@@ -7323,9 +7328,14 @@ def __init__(self,
73237328
must tolerate unexpected values.
73247329
:param List[RouteReportConnection] virtual_connection_routes: Array of
73257330
routes on virtual connections.
7331+
:param List[RouteReportAdvertisedRoute] advertised_routes: (optional) Array
7332+
of connection prefixes advertised to the on-prem network. This parameter is
7333+
not returned when the route report was generated prior to inclusion of this
7334+
parameter.
73267335
:param datetime updated_at: (optional) Date and time route report was last
73277336
modified.
73287337
"""
7338+
self.advertised_routes = advertised_routes
73297339
self.created_at = created_at
73307340
self.gateway_routes = gateway_routes
73317341
self.id = id
@@ -7339,6 +7349,8 @@ def __init__(self,
73397349
def from_dict(cls, _dict: Dict) -> 'RouteReport':
73407350
"""Initialize a RouteReport object from a json dictionary."""
73417351
args = {}
7352+
if 'advertised_routes' in _dict:
7353+
args['advertised_routes'] = [RouteReportAdvertisedRoute.from_dict(v) for v in _dict.get('advertised_routes')]
73427354
if 'created_at' in _dict:
73437355
args['created_at'] = string_to_datetime(_dict.get('created_at'))
73447356
else:
@@ -7379,6 +7391,14 @@ def _from_dict(cls, _dict):
73797391
def to_dict(self) -> Dict:
73807392
"""Return a json dictionary representing this model."""
73817393
_dict = {}
7394+
if hasattr(self, 'advertised_routes') and self.advertised_routes is not None:
7395+
advertised_routes_list = []
7396+
for v in self.advertised_routes:
7397+
if isinstance(v, dict):
7398+
advertised_routes_list.append(v)
7399+
else:
7400+
advertised_routes_list.append(v.to_dict())
7401+
_dict['advertised_routes'] = advertised_routes_list
73827402
if hasattr(self, 'created_at') and self.created_at is not None:
73837403
_dict['created_at'] = datetime_to_string(self.created_at)
73847404
if hasattr(self, 'gateway_routes') and self.gateway_routes is not None:
@@ -7448,6 +7468,72 @@ class StatusEnum(str, Enum):
74487468
PENDING = 'pending'
74497469

74507470

7471+
class RouteReportAdvertisedRoute():
7472+
"""
7473+
Route advertised to the on-prem network.
7474+
7475+
:attr str as_path: The BGP AS path of the route.
7476+
:attr str prefix: prefix.
7477+
"""
7478+
7479+
def __init__(self,
7480+
as_path: str,
7481+
prefix: str) -> None:
7482+
"""
7483+
Initialize a RouteReportAdvertisedRoute object.
7484+
7485+
:param str as_path: The BGP AS path of the route.
7486+
:param str prefix: prefix.
7487+
"""
7488+
self.as_path = as_path
7489+
self.prefix = prefix
7490+
7491+
@classmethod
7492+
def from_dict(cls, _dict: Dict) -> 'RouteReportAdvertisedRoute':
7493+
"""Initialize a RouteReportAdvertisedRoute object from a json dictionary."""
7494+
args = {}
7495+
if 'as_path' in _dict:
7496+
args['as_path'] = _dict.get('as_path')
7497+
else:
7498+
raise ValueError('Required property \'as_path\' not present in RouteReportAdvertisedRoute JSON')
7499+
if 'prefix' in _dict:
7500+
args['prefix'] = _dict.get('prefix')
7501+
else:
7502+
raise ValueError('Required property \'prefix\' not present in RouteReportAdvertisedRoute JSON')
7503+
return cls(**args)
7504+
7505+
@classmethod
7506+
def _from_dict(cls, _dict):
7507+
"""Initialize a RouteReportAdvertisedRoute object from a json dictionary."""
7508+
return cls.from_dict(_dict)
7509+
7510+
def to_dict(self) -> Dict:
7511+
"""Return a json dictionary representing this model."""
7512+
_dict = {}
7513+
if hasattr(self, 'as_path') and self.as_path is not None:
7514+
_dict['as_path'] = self.as_path
7515+
if hasattr(self, 'prefix') and self.prefix is not None:
7516+
_dict['prefix'] = self.prefix
7517+
return _dict
7518+
7519+
def _to_dict(self):
7520+
"""Return a json dictionary representing this model."""
7521+
return self.to_dict()
7522+
7523+
def __str__(self) -> str:
7524+
"""Return a `str` version of this RouteReportAdvertisedRoute object."""
7525+
return json.dumps(self.to_dict(), indent=2)
7526+
7527+
def __eq__(self, other: 'RouteReportAdvertisedRoute') -> bool:
7528+
"""Return `true` when self and other are equal, false otherwise."""
7529+
if not isinstance(other, self.__class__):
7530+
return False
7531+
return self.__dict__ == other.__dict__
7532+
7533+
def __ne__(self, other: 'RouteReportAdvertisedRoute') -> bool:
7534+
"""Return `true` when self and other are not equal, false otherwise."""
7535+
return not self == other
7536+
74517537
class RouteReportCollection():
74527538
"""
74537539
route reports.
@@ -7514,22 +7600,24 @@ class RouteReportConnection():
75147600
"""
75157601
Routes of a virtual connection.
75167602
7517-
:attr List[RouteReportRoute] routes: Array of virtual connection's routes.
7603+
:attr List[RouteReportVirtualConnectionRoute] routes: Array of virtual
7604+
connection's routes.
75187605
:attr str virtual_connection_id: (optional) ID of virtual connection.
75197606
:attr str virtual_connection_name: (optional) name of virtual connection.
75207607
:attr str virtual_connection_type: (optional) type of virtual connection.
75217608
"""
75227609

75237610
def __init__(self,
7524-
routes: List['RouteReportRoute'],
7611+
routes: List['RouteReportVirtualConnectionRoute'],
75257612
*,
75267613
virtual_connection_id: str = None,
75277614
virtual_connection_name: str = None,
75287615
virtual_connection_type: str = None) -> None:
75297616
"""
75307617
Initialize a RouteReportConnection object.
75317618
7532-
:param List[RouteReportRoute] routes: Array of virtual connection's routes.
7619+
:param List[RouteReportVirtualConnectionRoute] routes: Array of virtual
7620+
connection's routes.
75337621
:param str virtual_connection_id: (optional) ID of virtual connection.
75347622
:param str virtual_connection_name: (optional) name of virtual connection.
75357623
:param str virtual_connection_type: (optional) type of virtual connection.
@@ -7544,7 +7632,7 @@ def from_dict(cls, _dict: Dict) -> 'RouteReportConnection':
75447632
"""Initialize a RouteReportConnection object from a json dictionary."""
75457633
args = {}
75467634
if 'routes' in _dict:
7547-
args['routes'] = [RouteReportRoute.from_dict(v) for v in _dict.get('routes')]
7635+
args['routes'] = [RouteReportVirtualConnectionRoute.from_dict(v) for v in _dict.get('routes')]
75487636
else:
75497637
raise ValueError('Required property \'routes\' not present in RouteReportConnection JSON')
75507638
if 'virtual_connection_id' in _dict:
@@ -7601,27 +7689,33 @@ class RouteReportOnPremRoute():
76017689
"""
76027690
on-prem route.
76037691
7692+
:attr str as_path: (optional) The BGP AS path of the route.
76047693
:attr str next_hop: (optional) Next hop address.
76057694
:attr str prefix: (optional) prefix.
76067695
"""
76077696

76087697
def __init__(self,
76097698
*,
7699+
as_path: str = None,
76107700
next_hop: str = None,
76117701
prefix: str = None) -> None:
76127702
"""
76137703
Initialize a RouteReportOnPremRoute object.
76147704
7705+
:param str as_path: (optional) The BGP AS path of the route.
76157706
:param str next_hop: (optional) Next hop address.
76167707
:param str prefix: (optional) prefix.
76177708
"""
7709+
self.as_path = as_path
76187710
self.next_hop = next_hop
76197711
self.prefix = prefix
76207712

76217713
@classmethod
76227714
def from_dict(cls, _dict: Dict) -> 'RouteReportOnPremRoute':
76237715
"""Initialize a RouteReportOnPremRoute object from a json dictionary."""
76247716
args = {}
7717+
if 'as_path' in _dict:
7718+
args['as_path'] = _dict.get('as_path')
76257719
if 'next_hop' in _dict:
76267720
args['next_hop'] = _dict.get('next_hop')
76277721
if 'prefix' in _dict:
@@ -7636,6 +7730,8 @@ def _from_dict(cls, _dict):
76367730
def to_dict(self) -> Dict:
76377731
"""Return a json dictionary representing this model."""
76387732
_dict = {}
7733+
if hasattr(self, 'as_path') and self.as_path is not None:
7734+
_dict['as_path'] = self.as_path
76397735
if hasattr(self, 'next_hop') and self.next_hop is not None:
76407736
_dict['next_hop'] = self.next_hop
76417737
if hasattr(self, 'prefix') and self.prefix is not None:
@@ -7793,6 +7889,83 @@ def __ne__(self, other: 'RouteReportRoute') -> bool:
77937889
"""Return `true` when self and other are not equal, false otherwise."""
77947890
return not self == other
77957891

7892+
class RouteReportVirtualConnectionRoute():
7893+
"""
7894+
A route originating from an attached virtual connection.
7895+
7896+
:attr bool active: (optional) Indicates whether the route is the preferred path
7897+
of the prefix.
7898+
:attr str local_preference: (optional) The local preference of the route. This
7899+
attribute can manipulate the chosen path on routes.
7900+
:attr str prefix: prefix.
7901+
"""
7902+
7903+
def __init__(self,
7904+
prefix: str,
7905+
*,
7906+
active: bool = None,
7907+
local_preference: str = None) -> None:
7908+
"""
7909+
Initialize a RouteReportVirtualConnectionRoute object.
7910+
7911+
:param str prefix: prefix.
7912+
:param bool active: (optional) Indicates whether the route is the preferred
7913+
path of the prefix.
7914+
:param str local_preference: (optional) The local preference of the route.
7915+
This attribute can manipulate the chosen path on routes.
7916+
"""
7917+
self.active = active
7918+
self.local_preference = local_preference
7919+
self.prefix = prefix
7920+
7921+
@classmethod
7922+
def from_dict(cls, _dict: Dict) -> 'RouteReportVirtualConnectionRoute':
7923+
"""Initialize a RouteReportVirtualConnectionRoute object from a json dictionary."""
7924+
args = {}
7925+
if 'active' in _dict:
7926+
args['active'] = _dict.get('active')
7927+
if 'local_preference' in _dict:
7928+
args['local_preference'] = _dict.get('local_preference')
7929+
if 'prefix' in _dict:
7930+
args['prefix'] = _dict.get('prefix')
7931+
else:
7932+
raise ValueError('Required property \'prefix\' not present in RouteReportVirtualConnectionRoute JSON')
7933+
return cls(**args)
7934+
7935+
@classmethod
7936+
def _from_dict(cls, _dict):
7937+
"""Initialize a RouteReportVirtualConnectionRoute object from a json dictionary."""
7938+
return cls.from_dict(_dict)
7939+
7940+
def to_dict(self) -> Dict:
7941+
"""Return a json dictionary representing this model."""
7942+
_dict = {}
7943+
if hasattr(self, 'active') and self.active is not None:
7944+
_dict['active'] = self.active
7945+
if hasattr(self, 'local_preference') and self.local_preference is not None:
7946+
_dict['local_preference'] = self.local_preference
7947+
if hasattr(self, 'prefix') and self.prefix is not None:
7948+
_dict['prefix'] = self.prefix
7949+
return _dict
7950+
7951+
def _to_dict(self):
7952+
"""Return a json dictionary representing this model."""
7953+
return self.to_dict()
7954+
7955+
def __str__(self) -> str:
7956+
"""Return a `str` version of this RouteReportVirtualConnectionRoute object."""
7957+
return json.dumps(self.to_dict(), indent=2)
7958+
7959+
def __eq__(self, other: 'RouteReportVirtualConnectionRoute') -> bool:
7960+
"""Return `true` when self and other are equal, false otherwise."""
7961+
if not isinstance(other, self.__class__):
7962+
return False
7963+
return self.__dict__ == other.__dict__
7964+
7965+
def __ne__(self, other: 'RouteReportVirtualConnectionRoute') -> bool:
7966+
"""Return `true` when self and other are not equal, false otherwise."""
7967+
return not self == other
7968+
77967969
class UpdateRouteFilterTemplate():
77977970
"""
77987971
The route filter update template.

0 commit comments

Comments
 (0)