+ def attachExternalSAP(self, sap_name, sap_net, **params):
+ # create SAP as separate OVS switch with an assigned ip address
+ sap_ip = str(sap_net[1]) + '/' + str(sap_net.prefixlen)
+ sap_switch = self.net.addExtSAP(sap_name, sap_ip, dpid=hex(self._get_next_extSAP_dpid())[2:], **params)
+ sap_switch.start()
+
+ # link SAP to the DC switch
+ self.net.addLink(sap_switch, self.switch, cls=Link)
+
+ # allow connection to the external internet through the host
+ self.net.addSAPNAT(sap_switch, str(sap_net))
+