use of org.opendaylight.protocol.pcep.PCEPSessionNegotiatorFactory in project bgpcep by opendaylight.
the class PCCMock method main.
public static void main(final String[] args) throws InterruptedException, ExecutionException {
Preconditions.checkArgument(args.length > 0, "Host and port of server must be provided.");
final List<PCEPCapability> caps = new ArrayList<>();
final PCEPSessionProposalFactory proposal = new BasePCEPSessionProposalFactory((short) 120, (short) 30, caps);
final PCEPSessionNegotiatorFactory snf = new DefaultPCEPSessionNegotiatorFactory(proposal, 0);
final HostAndPort serverHostAndPort = HostAndPort.fromString(args[0]);
final InetSocketAddress serverAddr = new InetSocketAddress(serverHostAndPort.getHost(), serverHostAndPort.getPortOrDefault(12345));
final InetSocketAddress clientAddr = InetSocketAddressUtil.getRandomLoopbackInetSocketAddress(0);
try (PCCDispatcherImpl pccDispatcher = new PCCDispatcherImpl(ServiceLoaderPCEPExtensionProviderContext.getSingletonInstance().getMessageHandlerRegistry())) {
pccDispatcher.createClient(serverAddr, -1, SimpleSessionListener::new, snf, KeyMapping.getKeyMapping(), clientAddr).get();
}
}
Aggregations