Merge "Exposing is_input_or_output for sma_connector"
This commit is contained in:
@@ -78,11 +78,11 @@ class PTPNic:
|
||||
"""
|
||||
sma1_dict = None
|
||||
if self.sma1:
|
||||
sma1_dict = self.sma1.to_dictionary()
|
||||
sma1_dict = self.sma1.to_dictionary(self.name)
|
||||
|
||||
sma2_dict = None
|
||||
if self.sma2:
|
||||
sma2_dict = self.sma2.to_dictionary()
|
||||
sma2_dict = self.sma2.to_dictionary(self.name)
|
||||
|
||||
ufl1_dict = None
|
||||
if self.ufl1:
|
||||
|
||||
@@ -58,12 +58,15 @@ class SMAConnector:
|
||||
"""
|
||||
return self.name
|
||||
|
||||
def to_dictionary(self) -> Dict[str, str]:
|
||||
def to_dictionary(self, nic_name: str) -> Dict[str, str]:
|
||||
"""
|
||||
This function will return a dictionary view of the SMA Connector.
|
||||
|
||||
This is mostly used for substitution in JINJA templates.
|
||||
|
||||
Args:
|
||||
nic_name (str): Name of the nic attached to this ptp_nic_connection
|
||||
|
||||
Returns:
|
||||
Dict[str, str]: Dictionary representation
|
||||
|
||||
@@ -74,9 +77,26 @@ class SMAConnector:
|
||||
"input_sma": self.input_sma,
|
||||
"output_nic": self.output_nic,
|
||||
"output_sma": self.output_sma,
|
||||
"is_input_or_output": self.is_input_or_output(nic_name),
|
||||
}
|
||||
return dictionary
|
||||
|
||||
def is_input_or_output(self, nic_name: str) -> str:
|
||||
"""
|
||||
This function will return 'input' or 'output' if the specified nic_name is used as an input/output for this sma_connector.
|
||||
|
||||
Args:
|
||||
nic_name (str): Name of the nic attached to this sma_connector
|
||||
|
||||
Returns:
|
||||
str: 'input' or 'output'
|
||||
|
||||
"""
|
||||
if self.input_nic == nic_name:
|
||||
return "input"
|
||||
else:
|
||||
return "output"
|
||||
|
||||
def get_name(self) -> str:
|
||||
"""
|
||||
Retrieves the name from the SMA connector.
|
||||
|
||||
Reference in New Issue
Block a user