Search in sources :

Example 1 with ServicePort

use of com.yahoo.vespa.serviceview.bindings.ServicePort in project vespa by vespa-engine.

the class ServiceModel method addService.

private static void addService(Table<String, String, List<Service>> services, String hostName, com.yahoo.vespa.serviceview.bindings.Service s) {
    boolean hasStateApi = false;
    int statePort = 0;
    List<Integer> ports = new ArrayList<>(s.ports.size());
    for (ServicePort port : s.ports) {
        ports.add(port.number);
        if (!hasStateApi && port.hasTags("http", "state")) {
            hasStateApi = true;
            statePort = port.number;
        }
    }
    // ignore hosts without state API
    if (hasStateApi) {
        Service service = new Service(s.type, hostName, statePort, s.clustername, s.clustertype, s.configid, ports, s.name);
        getAndSetEntry(services, s.clustername, s.clustertype).add(service);
    }
}
Also used : ServicePort(com.yahoo.vespa.serviceview.bindings.ServicePort) ArrayList(java.util.ArrayList) HostService(com.yahoo.vespa.serviceview.bindings.HostService)

Example 2 with ServicePort

use of com.yahoo.vespa.serviceview.bindings.ServicePort in project vespa by vespa-engine.

the class ServiceModelTest method syntheticModelResponse.

static ModelResponse syntheticModelResponse() {
    ModelResponse model = new ModelResponse();
    HostService h = new HostService();
    h.name = "vespa.yahoo.com";
    com.yahoo.vespa.serviceview.bindings.Service service0 = new com.yahoo.vespa.serviceview.bindings.Service();
    {
        service0.clustername = "examplecluster";
        service0.clustertype = "somethingservers";
        service0.index = 1L;
        service0.type = "something";
        service0.name = "examplename";
        service0.configid = "blblb/lbl.0";
        ServicePort port = new ServicePort();
        port.number = Defaults.getDefaults().vespaWebServicePort();
        port.tags = "state http";
        service0.ports = Collections.singletonList(port);
    }
    com.yahoo.vespa.serviceview.bindings.Service service1 = new com.yahoo.vespa.serviceview.bindings.Service();
    {
        service1.clustername = "examplecluster";
        service1.clustertype = "somethingservers";
        service1.index = 2L;
        service1.type = "container-clustercontroller";
        service1.name = "clustercontroller";
        service1.configid = "clustercontroller/lbl.0";
        ServicePort port = new ServicePort();
        port.number = 4090;
        port.tags = "state http";
        service1.ports = Collections.singletonList(port);
    }
    com.yahoo.vespa.serviceview.bindings.Service service2 = new com.yahoo.vespa.serviceview.bindings.Service();
    {
        service2.clustername = "tralala";
        service2.clustertype = "admin";
        service2.index = 3L;
        service2.type = "configserver";
        service2.name = "configservername";
        service2.configid = "clustercontroller/lbl.0";
        ServicePort port = new ServicePort();
        port.number = 5000;
        port.tags = "state http";
        service2.ports = Collections.singletonList(port);
    }
    h.services = Arrays.asList(service0, service1, service2);
    model.hosts = Collections.singletonList(h);
    return model;
}
Also used : HostService(com.yahoo.vespa.serviceview.bindings.HostService) ServicePort(com.yahoo.vespa.serviceview.bindings.ServicePort) ModelResponse(com.yahoo.vespa.serviceview.bindings.ModelResponse) HostService(com.yahoo.vespa.serviceview.bindings.HostService)

Aggregations

HostService (com.yahoo.vespa.serviceview.bindings.HostService)2 ServicePort (com.yahoo.vespa.serviceview.bindings.ServicePort)2 ModelResponse (com.yahoo.vespa.serviceview.bindings.ModelResponse)1 ArrayList (java.util.ArrayList)1