'Generate port mapping for new edge.
src: source switch name
dst: destination switch name'

def addPort(self, src, dst, sport=None, dport=None):

    ports = self.ports
    ports.setdefault(src, {})
    ports.setdefault(dst, {})
    if (sport is None):
        src_base = (1 if self.isSwitch(src) else 0)
        sport = (len(ports[src]) + src_base)
    if (dport is None):
        dst_base = (1 if self.isSwitch(dst) else 0)
        dport = (len(ports[dst]) + dst_base)
    ports[src][sport] = (dst, dport)
    ports[dst][dport] = (src, sport)
    return (sport, dport)
