Search in sources :

Example 1 with Flow

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow in project java-dialogflow-cx by googleapis.

the class ITSystemTest method getFlowTest.

@Test
public void getFlowTest() {
    GetFlowRequest request = GetFlowRequest.newBuilder().setName(flowName).build();
    Flow flow = flowsClient.getFlow(request);
    assertFlowDetails(flow);
}
Also used : GetFlowRequest(com.google.cloud.dialogflow.cx.v3beta1.GetFlowRequest) Flow(com.google.cloud.dialogflow.cx.v3beta1.Flow) Test(org.junit.Test)

Example 2 with Flow

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow in project java-dialogflow-cx by googleapis.

the class ITSystemTest method listFlowsTest.

@Test
public void listFlowsTest() {
    ListFlowsRequest request = ListFlowsRequest.newBuilder().setParent(agentName).build();
    FlowsClient.ListFlowsPagedResponse pagedListResponse = flowsClient.listFlows(request);
    List<Flow> flows = Lists.newArrayList(pagedListResponse.iterateAll());
    boolean isFlowExists = false;
    for (Flow flow : flows) {
        if (flow.getName().equals(flowName)) {
            assertFlowDetails(flow);
            isFlowExists = true;
        }
    }
    assertTrue(isFlowExists);
}
Also used : FlowsClient(com.google.cloud.dialogflow.cx.v3beta1.FlowsClient) ListFlowsRequest(com.google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest) Flow(com.google.cloud.dialogflow.cx.v3beta1.Flow) Test(org.junit.Test)

Example 3 with Flow

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow in project java-dialogflow-cx by googleapis.

the class CreateFlowIT method testCreateFlowGlobal.

@Test
public void testCreateFlowGlobal() throws Exception {
    Flow result = CreateFlow.createFlow(DISPLAY_NAME, PROJECT_ID, LOCATION_GLOBAL, AGENT_ID_GLOBAL, EVENT_TO_FULFILLMENT_MESSAGES);
    newFlowNameGlobal = result.getName();
    assertEquals(result.getDisplayName(), DISPLAY_NAME);
    // Number of added event handlers + 2 default event handlers.
    assertEquals(result.getEventHandlersCount(), EVENT_TO_FULFILLMENT_MESSAGES.size() + 2);
}
Also used : Flow(com.google.cloud.dialogflow.cx.v3beta1.Flow) Test(org.junit.Test)

Example 4 with Flow

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow in project opennms-opendaylight-plugin by OpenNMS.

the class OpendaylightTopologyHandler method onEvent.

@Override
public void onEvent(InMemoryEvent event) {
    if (event == null || !IMPORT_SUCCESSFUL_UEI.equals(event.getUei())) {
        return;
    }
    // Extract the name of the referenced FS
    final String foreignSource = event.getParameterValue(PARM_FOREIGN_SOURCE).orElse(null);
    if (foreignSource == null) {
        LOG.warn("No foreign source parameter found on import successful event. Ignoring.");
        return;
    }
    if (!DEFAULT_FOREIGN_SOURCE.equals(foreignSource)) {
        LOG.debug("Ignoring foreign source: {}", foreignSource);
        return;
    }
    /*
        // TODO: Quickly determine whether or not we need to load the requisition - it may be large and unrelated

        // Retrieve a copy of the requisition in question
        final Requisition requisition = requisitionRepository.getDeployedRequisition(foreignSource);
        requisition.getNodes();

        // TODO: Figure out which controller
        */
    // Load the topology
    Topology operationalTopology;
    try {
        operationalTopology = client.getOperationalTopology("flow:1");
    } catch (Exception e) {
        LOG.error("Failed to load operational topology.", e);
        return;
    }
    // Index the links by source id
    final Map<String, List<Link>> linksBySourceId = operationalTopology.getLink().stream().collect(Collectors.groupingBy(l -> l.getSource().getSourceNode().getValue()));
    // Build a "ODL Node ID" to "OpenNMS Node" map
    final List<Node> nodes = nodeDao.getNodesInForeignSource(foreignSource);
    final Map<String, Node> nodesByLabel = nodes.stream().collect(Collectors.toMap(Node::getLabel, n -> n));
    for (Node node : nodes) {
        List<Link> expectedLinks = linksBySourceId.get(node.getLabel());
        pushLinkUpdates(node, expectedLinks, nodesByLabel);
    }
}
Also used : Logger(org.slf4j.Logger) DEFAULT_FOREIGN_SOURCE(org.opennms.plugins.odl.OpendaylightRequisitionProvider.DEFAULT_FOREIGN_SOURCE) LoggerFactory(org.slf4j.LoggerFactory) Set(java.util.Set) Node(org.opennms.integration.api.v1.model.Node) RequisitionRepository(org.opennms.integration.api.v1.requisition.RequisitionRepository) NodeDao(org.opennms.integration.api.v1.dao.NodeDao) EventSubscriptionService(org.opennms.integration.api.v1.events.EventSubscriptionService) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) Objects(java.util.Objects) Topology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology) List(java.util.List) EventListener(org.opennms.integration.api.v1.events.EventListener) ImmutableUserDefinedLink(org.opennms.integration.api.v1.topology.immutables.ImmutableUserDefinedLink) Map(java.util.Map) InMemoryEvent(org.opennms.integration.api.v1.model.InMemoryEvent) UserDefinedLinkDao(org.opennms.integration.api.v1.topology.UserDefinedLinkDao) UserDefinedLink(org.opennms.integration.api.v1.topology.UserDefinedLink) Link(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link) Node(org.opennms.integration.api.v1.model.Node) List(java.util.List) Topology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology) ImmutableUserDefinedLink(org.opennms.integration.api.v1.topology.immutables.ImmutableUserDefinedLink) UserDefinedLink(org.opennms.integration.api.v1.topology.UserDefinedLink) Link(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link)

Example 5 with Flow

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow in project opennms-opendaylight-plugin by OpenNMS.

the class OpendaylightRestconfClientIT method canGetNodeFromOperationalTopology.

@Test
public void canGetNodeFromOperationalTopology() throws Exception {
    stubFor(get(urlEqualTo("/restconf/operational/network-topology:network-topology/topology/flow:1/node/openflow:1")).willReturn(aResponse().withHeader("Content-Type", "Content-Type: application/yang.data+json; charset=utf-8").withBodyFile("operational-topology-node.json")));
    // Make the call
    OpendaylightRestconfClient client = new OpendaylightRestconfClient(String.format("http://localhost:%s", wireMockRule.port()));
    Node node = client.getNodeFromOperationalTopology("flow:1", "openflow:1");
    // Verify
    assertEquals("openflow:1", node.getNodeId().getValue());
}
Also used : Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) FlowNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowNode) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) Test(org.junit.Test)

Aggregations

Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)221 ArrayList (java.util.ArrayList)194 FlowId (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId)97 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)87 FlowKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey)75 Test (org.junit.Test)74 List (java.util.List)70 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)69 TableKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey)67 FlowBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder)66 BigInteger (java.math.BigInteger)61 Instruction (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction)61 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)60 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)55 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)52 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)52 FlowEntity (org.opendaylight.genius.mdsalutil.FlowEntity)51 InstructionInfo (org.opendaylight.genius.mdsalutil.InstructionInfo)50 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)48 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)47