Skip to content

Commit

Permalink
updated docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
kthare10 committed Jun 27, 2024
1 parent ca2ed8a commit e1f0857
Showing 1 changed file with 45 additions and 3 deletions.
48 changes: 45 additions & 3 deletions fabrictestbed_extensions/fablib/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@ def get_peer_port_vlan(self) -> str:
Returns the VLAN associated with the interface.
For shared NICs extracts it from label_allocations.
:return VLAN to be used for Port Mirroring
:return: VLAN to be used for Port Mirroring
:rtype: String
"""
vlan = self.get_vlan()
if not vlan:
Expand Down Expand Up @@ -572,8 +573,8 @@ def set_vlan(self, vlan: Any = None):
"""
Set the VLAN on the FABRIC request.
:param addr: vlan
:type addr: String or int
:param vlan: vlan
:type vlan: String or int
"""
if vlan:
vlan = str(vlan)
Expand Down Expand Up @@ -997,6 +998,17 @@ def config(self):
pass

def add_mirror(self, port_name: str, name: str = "mirror", vlan: str = None):
"""
Add Port Mirror Service
:param port_name: Mirror Port Name
:type port_name: String
:param vlan: Mirror Port vlan
:type vlan: String
:param name: Name of the Port Mirror service
:type name: String
"""
self.get_slice().get_fim_topology().add_port_mirror_service(
name=name,
from_interface_name=port_name,
Expand Down Expand Up @@ -1042,27 +1054,57 @@ def set_subnet(self, ipv4_subnet: str = None, ipv6_subnet: str = None):
raise e

def get_subnet(self):
"""
Get Subnet associated with the interface
:return: ipv4/ipv6 subnet associated with the interface
:rtype: String
"""
if self.get_fim() and self.get_fim().labels:
if self.get_fim().labels.ipv4_subnet:
return self.get_fim().labels.ipv4_subnet
if self.get_fim().labels.ipv6_subnet:
return self.get_fim().labels.ipv6_subnet

def get_peer_subnet(self):
"""
Get Peer Subnet associated with the interface
:return: peer ipv4/ipv6 subnet associated with the interface
:rtype: String
"""
if self.get_fim() and self.get_fim().peer_labels:
if self.get_fim().peer_labels.ipv4_subnet:
return self.get_fim().peer_labels.ipv4_subnet
if self.get_fim().peer_labels.ipv6_subnet:
return self.get_fim().peer_labels.ipv6_subnet

def get_peer_asn(self):
"""
Get Peer ASN; Set only for Peered Interface using L3Peering via AL2S
:return: peer asn
:rtype: String
"""
if self.get_fim() and self.get_fim().peer_labels:
return self.get_fim().peer_labels.asn

def get_peer_bgp_key(self):
"""
Get Peer BGP Key; Set only for Peered Interface using L3Peering via AL2S
:return: peer BGP Key
:rtype: String
"""
if self.get_fim() and self.get_fim().peer_labels:
return self.get_fim().peer_labels.bgp_key

def get_peer_account_id(self):
"""
Get Peer Account Id associated with the interface
:return: peer account id associated with the interface (Used when interface is peered to AWS via AL2S)
:rtype: String
"""
if self.get_fim() and self.get_fim().peer_labels:
return self.get_fim().peer_labels.account_id

0 comments on commit e1f0857

Please sign in to comment.