2 * Copyright (c) 2018 Bell Canada, Pantheon Technologies and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package io.fd.hc2vpp.srv6.write.encap.source.request;
19 import static com.google.common.base.Preconditions.checkNotNull;
21 import io.fd.hc2vpp.srv6.util.JVppRequest;
22 import io.fd.hc2vpp.srv6.write.WriteRequest;
23 import io.fd.honeycomb.translate.write.WriteFailedException;
24 import io.fd.vpp.jvpp.core.dto.SrSetEncapSource;
25 import io.fd.vpp.jvpp.core.future.FutureJVppCore;
26 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
27 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
29 public class EncapsulationSourceWriteRequest extends JVppRequest implements WriteRequest {
31 private Ipv6Address bsid;
33 public EncapsulationSourceWriteRequest(final FutureJVppCore api) {
38 public void checkValid() {
39 checkNotNull(bsid, "Binding SID must be set");
42 public Ipv6Address getBsid() {
46 public EncapsulationSourceWriteRequest setBsid(final Ipv6Address bsid) {
52 public void write(final InstanceIdentifier<?> identifier) throws WriteFailedException {
54 final SrSetEncapSource request = new SrSetEncapSource();
55 request.encapsSource = ipv6AddressNoZoneToArray(bsid);
56 getReplyForWrite(getApi().srSetEncapSource(request).toCompletableFuture(), identifier);