summaryrefslogtreecommitdiffstats
path: root/acl/acl-impl/pom.xml
blob: 3ea1d09ebb768705520e4d5f01ec14c201ec7af3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~  Copyright (c) 2015 Cisco and/or its affiliates.
  ~  Licensed under the Apache License, Version 2.0 (the "License");
  ~  you may not use this file except in compliance with the License.
  ~  You may obtain a copy of the License at:
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~  Unless required by applicable law or agreed to in writing, software
  ~  distributed under the License is distributed on an "AS IS" BASIS,
  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~  See the License for the specific language governing permissions and
  ~  limitations under the License.
  -->

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <groupId>io.fd.hc2vpp.common</groupId>
        <artifactId>impl-parent</artifactId>
        <version>1.19.04-SNAPSHOT</version>
        <relativePath>../../common/impl-parent</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <groupId>io.fd.hc2vpp.acl</groupId>
    <artifactId>acl-impl</artifactId>
    <version>1.19.04-SNAPSHOT</version>

    <properties>
        <jvpp.acl.version>19.04-SNAPSHOT</jvpp.acl.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>io.fd.honeycomb</groupId>
            <artifactId>cfg-init</artifactId>
        </dependency>

        <dependency>
            <groupId>io.fd.hc2vpp.acl</groupId>
            <artifactId>acl-api</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>io.fd.jvpp</groupId>
            <artifactId>jvpp-acl</artifactId>
            <version>${jvpp.acl.version}</version>
        </dependency>

        <!-- DI -->
        <dependency>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
        </dependency>
        <dependency>
            <groupId>net.jmob</groupId>
            <artifactId>guice.conf</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.inject.extensions</groupId>
            <artifactId>guice-multibindings</artifactId>
        </dependency>

        <!-- Infra dependencies -->
        <dependency>
            <groupId>io.fd.honeycomb</groupId>
            <artifactId>translate-spi</artifactId>
        </dependency>
        <dependency>
            <groupId>io.fd.honeycomb</groupId>
            <artifactId>translate-impl</artifactId>
        </dependency>
        <dependency>
            <groupId>io.fd.honeycomb</groupId>
            <artifactId>binding-init</artifactId>
        </dependency>

        <!-- HC2VPP Dependencies -->
        <dependency>
            <groupId>io.fd.hc2vpp.common</groupId>
            <artifactId>vpp-translate-utils</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!-- Test -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.inject.extensions</groupId>
            <artifactId>guice-testlib</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.fd.hc2vpp.common</groupId>
            <artifactId>vpp-translate-test</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.fd.honeycomb.infra</groupId>
            <artifactId>test-tools</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>
_interface_ip_command, static) = { .path = "set interface ip", .short_help = "IP4/IP6 commands", }; /* *INDENT-ON* */ void ip_del_all_interface_addresses (vlib_main_t * vm, u32 sw_if_index) { ip4_main_t *im4 = &ip4_main; ip4_address_t *ip4_addrs = 0; u32 *ip4_masks = 0; ip6_main_t *im6 = &ip6_main; ip6_address_t *ip6_addrs = 0; u32 *ip6_masks = 0; ip_interface_address_t *ia; int i; /* *INDENT-OFF* */ foreach_ip_interface_address (&im4->lookup_main, ia, sw_if_index, 0 /* honor unnumbered */, ({ ip4_address_t * x = (ip4_address_t *) ip_interface_address_get_address (&im4->lookup_main, ia); vec_add1 (ip4_addrs, x[0]); vec_add1 (ip4_masks, ia->address_length); })); /* *INDENT-ON* */ /* *INDENT-OFF* */ foreach_ip_interface_address (&im6->lookup_main, ia, sw_if_index, 0 /* honor unnumbered */, ({ ip6_address_t * x = (ip6_address_t *) ip_interface_address_get_address (&im6->lookup_main, ia); vec_add1 (ip6_addrs, x[0]); vec_add1 (ip6_masks, ia->address_length); })); /* *INDENT-ON* */ for (i = 0; i < vec_len (ip4_addrs); i++) ip4_add_del_interface_address (vm, sw_if_index, &ip4_addrs[i], ip4_masks[i], 1 /* is_del */ ); for (i = 0; i < vec_len (ip6_addrs); i++) ip6_add_del_interface_address (vm, sw_if_index, &ip6_addrs[i], ip6_masks[i], 1 /* is_del */ ); vec_free (ip4_addrs); vec_free (ip4_masks); vec_free (ip6_addrs); vec_free (ip6_masks); } static clib_error_t * ip_address_delete_cleanup (vnet_main_t * vnm, u32 hw_if_index, u32 is_create) { vlib_main_t *vm = vlib_get_main (); vnet_hw_interface_t *hw; if (is_create) return 0; hw = vnet_get_hw_interface (vnm, hw_if_index); ip_del_all_interface_addresses (vm, hw->sw_if_index); return 0; } VNET_HW_INTERFACE_ADD_DEL_FUNCTION (ip_address_delete_cleanup); static clib_error_t * add_del_ip_address (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { vnet_main_t *vnm = vnet_get_main (); ip4_address_t a4; ip6_address_t a6; clib_error_t *error = 0; u32 sw_if_index, length, is_del; sw_if_index = ~0; is_del = 0; if (unformat (input, "del")) is_del = 1; if (!unformat_user (input, unformat_vnet_sw_interface, vnm, &sw_if_index)) { error = clib_error_return (0, "unknown interface `%U'", format_unformat_error, input); goto done; } if (is_del && unformat (input, "all")) ip_del_all_interface_addresses (vm, sw_if_index); else if (unformat (input, "%U/%d", unformat_ip4_address, &a4, &length)) error = ip4_add_del_interface_address (vm, sw_if_index, &a4, length, is_del); else if (unformat (input, "%U/%d", unformat_ip6_address, &a6, &length)) error = ip6_add_del_interface_address (vm, sw_if_index, &a6, length, is_del); else { error = clib_error_return (0, "expected IP4/IP6 address/length `%U'", format_unformat_error, input); goto done; } done: return error; } /*? * Add an IP Address to an interface or remove and IP Address from an interface. * The IP Address can be an IPv4 or an IPv6 address. Interfaces may have multiple * IPv4 and IPv6 addresses. There is no concept of primary vs. secondary * interface addresses; they're just addresses. * * To display the addresses associated with a given interface, use the command * '<em>show interface address <interface></em>'. * * Note that the debug CLI does not enforce classful mask-width / addressing * constraints. * * @cliexpar * @parblock * An example of how to add an IPv4 address to an interface: * @cliexcmd{set interface ip address GigabitEthernet2/0/0 172.16.2.12/24} * * An example of how to add an IPv6 address to an interface: * @cliexcmd{set interface ip address GigabitEthernet2/0/0 @::a:1:1:0:7/126} * * To delete a specific interface ip address: * @cliexcmd{set interface ip address GigabitEthernet2/0/0 172.16.2.12/24 del} * * To delete all interfaces addresses (IPv4 and IPv6): * @cliexcmd{set interface ip address GigabitEthernet2/0/0 del all} * @endparblock ?*/ /* *INDENT-OFF* */ VLIB_CLI_COMMAND (set_interface_ip_address_command, static) = { .path = "set interface ip address", .function = add_del_ip_address, .short_help = "set interface ip address [del] <interface> <ip-addr>/<mask> | [all]", }; /* *INDENT-ON* */ /* Dummy init function to get us linked in. */ static clib_error_t * ip4_cli_init (vlib_main_t * vm) { return 0; } VLIB_INIT_FUNCTION (ip4_cli_init); /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */