'Get ofport specified by port[\'device\'], checking and reflecting
ofport changes.
If ofport is nonexistent, create and return one.'

def get_or_create_ofport(self, port):

    port_id = port['device']
    ovs_port = self.get_ovs_port(port_id)
    try:
        of_port = self.sg_port_map.ports[port_id]
    except KeyError:
        port_vlan_id = self._get_port_vlan_tag(ovs_port.port_name)
        of_port = OFPort(port, ovs_port, port_vlan_id)
        self.sg_port_map.create_port(of_port, port)
    else:
        if (of_port.ofport != ovs_port.ofport):
            self.sg_port_map.remove_port(of_port)
            of_port = OFPort(port, ovs_port, of_port.vlan_tag)
        self.sg_port_map.update_port(of_port, port)
    return of_port
