Merge "Add support for various callbox network options"
diff --git a/acts/framework/acts/controllers/cellular_lib/LteSimulation.py b/acts/framework/acts/controllers/cellular_lib/LteSimulation.py
index 0918ac9..250a0d1 100644
--- a/acts/framework/acts/controllers/cellular_lib/LteSimulation.py
+++ b/acts/framework/acts/controllers/cellular_lib/LteSimulation.py
@@ -22,6 +22,13 @@
 from acts.controllers.cellular_lib import BaseCellularDut
 
 
+class IPAddressType(Enum):
+    """ IP Address types"""
+    IPV4 = "IPV4"
+    IPV6 = "IPV6"
+    IPV4V6 = "IPV4V6"
+
+
 class TransmissionMode(Enum):
     """ Transmission modes for LTE (e.g., TM1, TM4, ...) """
     TM1 = "TM1"
diff --git a/acts/framework/acts/controllers/cellular_simulator.py b/acts/framework/acts/controllers/cellular_simulator.py
index a84b22a..471b14a 100644
--- a/acts/framework/acts/controllers/cellular_simulator.py
+++ b/acts/framework/acts/controllers/cellular_simulator.py
@@ -428,6 +428,30 @@
         """
         raise NotImplementedError()
 
+    def set_apn(self, apn):
+        """ Configures the callbox network Access Point Name.
+
+        Args:
+            apn: the APN name
+        """
+        raise NotImplementedError()
+
+    def set_ip_type(self, ip_type):
+        """ Configures the callbox network IP type.
+
+        Args:
+            ip_type: the network type to use.
+        """
+        raise NotImplementedError()
+
+    def set_mtu(self, mtu):
+        """ Configures the callbox network Maximum Transmission Unit.
+
+        Args:
+            mtu: the MTU size.
+        """
+        raise NotImplementedError()
+
     def lte_attach_secondary_carriers(self, ue_capability_enquiry):
         """ Activates the secondary carriers for CA. Requires the DUT to be
         attached to the primary carrier first.
diff --git a/acts/framework/acts/controllers/rohdeschwarz_lib/cmw500.py b/acts/framework/acts/controllers/rohdeschwarz_lib/cmw500.py
index 39e921f..eb54b55 100644
--- a/acts/framework/acts/controllers/rohdeschwarz_lib/cmw500.py
+++ b/acts/framework/acts/controllers/rohdeschwarz_lib/cmw500.py
@@ -33,6 +33,13 @@
 STATE_CHANGE_TIMEOUT = 20
 
 
+class IPAddressType(Enum):
+    """ IP Address types"""
+    IPV4 = "IPV4"
+    IPV6 = "IPV6"
+    IPV4V6 = "IPV46"
+
+
 class SignallingState(Enum):
     """Signalling states common to all RATs."""
     ON = 'ON'
@@ -721,6 +728,58 @@
         cmd = 'CONFigure:LTE:SIGN:CONNection:CDRX:SOFFset {}'.format(offset)
         self.send_and_recv(cmd)
 
+    @property
+    def apn(self):
+        """Gets the callbox network Access Point Name."""
+        cmd = 'CONFigure:LTE:SIGNaling:CONNection:APN?'
+        return self.send_and_recv(cmd)
+
+    @apn.setter
+    def apn(self, apn):
+        """Sets the callbox network Access Point Name.
+
+        Args:
+            apn: the APN name
+        """
+        cmd = 'CONFigure:LTE:SIGNaling:CONNection:APN {}'.format(apn)
+        self.send_and_recv(cmd)
+
+    @property
+    def ip_type(self):
+        """Gets the callbox network IP type."""
+        cmd = 'CONFigure:LTE:SIGNaling:CONNection:IPVersion?'
+        return self.send_and_recv(cmd)
+
+    @ip_type.setter
+    def ip_type(self, ip_type):
+        """ Configures the callbox network IP type.
+
+        Args:
+            ip_type: the network type to use.
+        """
+        if not isinstance(ip_type, IPAddressType):
+            raise ValueError('state should be the instance of IPAddressType.')
+
+        cmd = 'CONFigure:LTE:SIGNaling:CONNection:IPVersion {}'.format(
+            ip_type.value)
+        return self.send_and_recv(cmd)
+
+    @property
+    def mtu(self):
+        """Gets the callbox network Maximum Transmission Unit."""
+        cmd = 'CONFigure:DATA:CONTrol:MTU?'
+        return self.send_and_recv(cmd)
+
+    @mtu.setter
+    def mtu(self, mtu):
+        """Sets the callbox network Maximum Transmission Unit.
+
+        Args:
+            mtu: the MTU size.
+        """
+        cmd = 'CONFigure:DATA:CONTrol:MTU {}'.format(mtu)
+        self.send_and_recv(cmd)
+
     def get_base_station(self, bts_num=BtsNumber.BTS1):
         """Gets the base station object based on bts num. By default
         bts_num set to PCC
diff --git a/acts/framework/acts/controllers/rohdeschwarz_lib/cmw500_cellular_simulator.py b/acts/framework/acts/controllers/rohdeschwarz_lib/cmw500_cellular_simulator.py
index f4c911a..4ac414b 100644
--- a/acts/framework/acts/controllers/rohdeschwarz_lib/cmw500_cellular_simulator.py
+++ b/acts/framework/acts/controllers/rohdeschwarz_lib/cmw500_cellular_simulator.py
@@ -46,6 +46,12 @@
     LteSimulation.MimoMode.MIMO_4x4: 4,
 }
 
+IP_ADDRESS_TYPE_MAPPING = {
+    LteSimulation.IPAddressType.IPV4: cmw500.IPAddressType.IPV4,
+    LteSimulation.IPAddressType.IPV6: cmw500.IPAddressType.IPV6,
+    LteSimulation.IPAddressType.IPV4V6: cmw500.IPAddressType.IPV4V6,
+}
+
 # get mcs vs tbsi map with 256-qam disabled(downlink)
 get_mcs_tbsi_map_dl = {
     cmw500.ModulationType.QPSK: {
@@ -641,6 +647,30 @@
         """
         self.cmw.drx_long_cycle_offset = offset
 
+    def set_apn(self, apn):
+        """ Configures the callbox network Access Point Name.
+
+        Args:
+            apn: the APN name
+        """
+        self.cmw.apn = apn
+
+    def set_ip_type(self, ip_type):
+        """ Configures the callbox network IP type.
+
+        Args:
+            ip_type: the network type to use.
+        """
+        self.cmw.ip_type = IP_ADDRESS_TYPE_MAPPING[ip_type]
+
+    def set_mtu(self, mtu):
+        """ Configures the callbox network Maximum Transmission Unit.
+
+        Args:
+            mtu: the MTU size.
+        """
+        self.cmw.mtu = mtu
+
     def lte_attach_secondary_carriers(self, ue_capability_enquiry):
         """ Activates the secondary carriers for CA. Requires the DUT to be
         attached to the primary carrier first.