2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.protocol.bgp.parser.parameter;
10 import org.opendaylight.protocol.bgp.concepts.BGPTableType;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
15 * Multiprotocol capability Parameter as described in:
17 * <a href="http://tools.ietf.org/html/rfc4760#section-8">Use of BGP Capability Advertisement/a>
19 public final class MultiprotocolCapability extends CapabilityParameter {
22 * Capability Code is set to 1, which indicates Multiprotocol Extensions capabilities.
24 public static final int CODE = 1;
26 private final BGPTableType tableType;
29 * Creates Multiprotocol Capability.
32 * @param type bgp table type
34 public MultiprotocolCapability(final BGPTableType type) {
36 this.tableType = type;
40 * Returns numeric representation of AFI.
44 public Class<? extends AddressFamily> getAfi() {
45 return this.tableType.getAddressFamily();
49 * Returns numeric representation of SAFI.
53 public Class<? extends SubsequentAddressFamily> getSafi() {
54 return this.tableType.getSubsequentAddressFamily();
58 * Returns BGP Table Type that is supported by the sender of this capability.
60 * @return BGP Table Type
62 public BGPTableType getTableType() {
63 return this.tableType;
67 * @see java.lang.Object#toString()
70 public String toString() {
71 final StringBuilder builder = new StringBuilder();
72 builder.append("MultiprotocolCapability [tableType=");
73 builder.append(this.tableType);
75 return builder.toString();