def get_neighbor_port(graph, neighbor):
    """
    Function for get port for connector according neighbor listener port.
    :param graph: graph
    :param neighbor: neighbor name
    :return: port number
    """
    test = graph.nodes(data=True)[neighbor]
    try:
        if 'listener' in test:
            for item in test['listener']:
                if 'role' in item:
                    if 'inter-route' in item['role']:
                        return item['port']
                else:
                    raise AttributeError
    except AttributeError:
        raise AttributeError("Listener doesn't contains role!")
