Merge pull request #1269 from kernelkit/rename
@@ -93,14 +93,14 @@ Each test case is a separate executable, which can be run without
|
||||
arguments:
|
||||
|
||||
```
|
||||
11:42:53 infamy0:test # ./case/infix_dhcp/dhcp_basic.py
|
||||
11:42:53 infamy0:test # ./case/dhcp/dhcp_basic.py
|
||||
```
|
||||
|
||||
To run a suite of tests, e.g., only the DHCP client tests, pass the
|
||||
suite as an argument to [9PM][]:
|
||||
|
||||
```
|
||||
11:42:53 infamy0:test # ./9pm/9pm.py case/infix_dhcp/infix_dhcp.yaml
|
||||
11:42:53 infamy0:test # ./9pm/9pm.py case/dhcp/dhcp.yaml
|
||||
```
|
||||
|
||||
To run the suite of all tests:
|
||||
@@ -234,12 +234,12 @@ your test and run it as normal. Once Python executes the call, it will
|
||||
drop you into the Python debugger:
|
||||
|
||||
```
|
||||
11:42:58 infamy0:test # ./case/infix_dhcp/dhcp_basic.py
|
||||
11:42:58 infamy0:test # ./case/dhcp/dhcp_basic.py
|
||||
# Starting (2024-02-10 11:42:59)
|
||||
# Probing dut1 on port d1a for IPv6LL mgmt address ...
|
||||
# Connecting to mgmt IP fe80::ff:fe00:0%d1a:830 ...
|
||||
ok 1 - Initialize
|
||||
> /home/jocke/src/infix/test/case/infix_dhcp/dhcp_basic.py(44)<module>()
|
||||
> /home/jocke/src/infix/test/case/dhcp/dhcp_basic.py(44)<module>()
|
||||
(Pdb)
|
||||
```
|
||||
|
||||
@@ -252,7 +252,7 @@ want to setup breakpoints without modifying the source, or simply step
|
||||
through the code:
|
||||
|
||||
```
|
||||
11:42:58 infamy0:test # python -m pdb case/infix_dhcp/dhcp_basic.py
|
||||
11:42:58 infamy0:test # python -m pdb case/dhcp/dhcp_basic.py
|
||||
```
|
||||
|
||||
### Deterministic Topology Mappings
|
||||
@@ -296,7 +296,7 @@ This is useful because this value can then be used to rerun a test (or
|
||||
the whole suite) with identical topology mappings:
|
||||
|
||||
```
|
||||
$ make PYTHONHASHSEED=3773822171 TESTS=case/ietf_system/hostname.py test
|
||||
$ make PYTHONHASHSEED=3773822171 TESTS=case/system/hostname.py test
|
||||
```
|
||||
|
||||
### Deterministic Transport Protocol
|
||||
@@ -307,14 +307,14 @@ you get the same protocol used for that hash. But if you want to choose
|
||||
the protocol, add extra arguments to Infamy:
|
||||
|
||||
```
|
||||
$ make INFAMY_EXTRA_ARGS="--transport=restconf" TESTS=case/ietf_system/hostname.py test
|
||||
$ make INFAMY_EXTRA_ARGS="--transport=restconf" TESTS=case/system/hostname.py test
|
||||
```
|
||||
|
||||
or, when running interactively:
|
||||
|
||||
```
|
||||
$ make test-sh
|
||||
09:08:17 infamy0:test # ./9pm/9pm.py -o"--transport=restconf" case/ietf_system/hostname.py
|
||||
09:08:17 infamy0:test # ./9pm/9pm.py -o"--transport=restconf" case/system/hostname.py
|
||||
```
|
||||
|
||||
### Test specification
|
||||
@@ -360,7 +360,7 @@ to start by reviewing an existing test case.
|
||||
|
||||
All tests are located in the `infix/test/case` repository and are
|
||||
grouped by the features they verify. For example,
|
||||
`infix/test/case/infix_services` contains tests for various Infix
|
||||
`infix/test/case/services` contains tests for various Infix
|
||||
services, such as LLDP and mDNS.
|
||||
|
||||
While test grouping is flexible, each test should be placed in a
|
||||
@@ -372,12 +372,12 @@ suite](#running-subsets-of-tests):
|
||||
|
||||
```
|
||||
- name: infix-services
|
||||
suite: infix_services/infix_services.yaml
|
||||
suite: services/services.yaml
|
||||
```
|
||||
|
||||
A new test (e.g., lldp_enable_disable) should be added to the
|
||||
corresponding test group .yaml file, such as
|
||||
`infix/test/cases/infix_services.yaml`:
|
||||
`infix/test/cases/services.yaml`:
|
||||
|
||||
```
|
||||
- name: lldp_enable_disable
|
||||
@@ -385,7 +385,7 @@ corresponding test group .yaml file, such as
|
||||
```
|
||||
|
||||
It is necessary to include the test in
|
||||
`infix/test/case/infix_services/Readme.adoc` to ensure proper test
|
||||
`infix/test/case/services/Readme.adoc` to ensure proper test
|
||||
specification generation:
|
||||
|
||||
```
|
||||
@@ -393,7 +393,7 @@ include::lldp_enable_disable/Readme.adoc[]
|
||||
```
|
||||
|
||||
Each test case should have its own directory under,
|
||||
`infix/test/case/infix_services`, containing:
|
||||
`infix/test/case/services`, containing:
|
||||
|
||||
- `test.py` - the test script
|
||||
- `topology.dot` - the logical topology definition.
|
||||
|
||||
@@ -26,36 +26,36 @@ confd_plugin_la_SOURCES = \
|
||||
base64.c base64.h \
|
||||
core.c core.h \
|
||||
dagger.c dagger.h \
|
||||
ietf-interfaces.c ietf-interfaces.h \
|
||||
interfaces.c interfaces.h \
|
||||
ieee802-ethernet-interface.c \
|
||||
ietf-ip.c \
|
||||
infix-if-bridge.c \
|
||||
infix-if-lag.c \
|
||||
infix-if-bridge-mcd.c \
|
||||
infix-if-bridge-port.c \
|
||||
infix-if-veth.c \
|
||||
infix-if-vlan.c \
|
||||
infix-if-gre.c \
|
||||
infix-if-vxlan.c \
|
||||
infix-if-wifi.c \
|
||||
ietf-keystore.c \
|
||||
ietf-system.c \
|
||||
ietf-syslog.c \
|
||||
ietf-factory-default.c \
|
||||
ietf-routing.c \
|
||||
infix-dhcp-common.c \
|
||||
infix-dhcp-client.c \
|
||||
infix-dhcpv6-client.c \
|
||||
infix-dhcp-server.c \
|
||||
infix-factory.c \
|
||||
infix-firewall.c \
|
||||
infix-meta.c \
|
||||
infix-services.c \
|
||||
infix-system-software.c \
|
||||
ietf-hardware.c
|
||||
ip.c \
|
||||
if-bridge.c \
|
||||
if-lag.c \
|
||||
if-bridge-mcd.c \
|
||||
if-bridge-port.c \
|
||||
if-veth.c \
|
||||
if-vlan.c \
|
||||
if-gre.c \
|
||||
if-vxlan.c \
|
||||
if-wifi.c \
|
||||
keystore.c \
|
||||
system.c \
|
||||
syslog.c \
|
||||
factory-default.c \
|
||||
routing.c \
|
||||
dhcp-common.c \
|
||||
dhcp-client.c \
|
||||
dhcpv6-client.c \
|
||||
dhcp-server.c \
|
||||
factory.c \
|
||||
firewall.c \
|
||||
meta.c \
|
||||
services.c \
|
||||
system-software.c \
|
||||
hardware.c
|
||||
|
||||
if CONTAINERS
|
||||
confd_plugin_la_SOURCES += infix-containers.c cni.c cni.h
|
||||
confd_plugin_la_SOURCES += containers.c cni.c cni.h
|
||||
endif
|
||||
|
||||
rauc_installer_sources = \
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "core.h"
|
||||
#include "cni.h"
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
#define CNI_NAME "/etc/cni/net.d/%s.conflist"
|
||||
|
||||
|
||||
@@ -349,7 +349,7 @@ static int del(const char *name)
|
||||
return SR_ERR_OK;
|
||||
}
|
||||
|
||||
int infix_containers_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd)
|
||||
int containers_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd)
|
||||
{
|
||||
struct lyd_node *cifs, *difs, *cif, *dif;
|
||||
sr_error_t err = 0;
|
||||
@@ -465,7 +465,7 @@ static int oci_load(sr_session_ctx_t *session, uint32_t sub_id, const char *xpat
|
||||
return SR_ERR_OK;
|
||||
}
|
||||
|
||||
int infix_containers_rpc_init(struct confd *confd)
|
||||
int containers_rpc_init(struct confd *confd)
|
||||
{
|
||||
int rc;
|
||||
|
||||
@@ -191,57 +191,57 @@ static int change_cb(sr_session_ctx_t *session, uint32_t sub_id, const char *mod
|
||||
}
|
||||
|
||||
/* ietf-interfaces */
|
||||
if ((rc = ietf_interfaces_change(session, config, diff, event, confd)))
|
||||
if ((rc = interfaces_change(session, config, diff, event, confd)))
|
||||
goto free_diff;
|
||||
|
||||
/* infix-dhcp-client*/
|
||||
if ((rc = infix_dhcp_client_change(session, config, diff, event, confd)))
|
||||
if ((rc = dhcp_client_change(session, config, diff, event, confd)))
|
||||
goto free_diff;
|
||||
|
||||
/* infix-dhcpv6-client*/
|
||||
if ((rc = infix_dhcpv6_client_change(session, config, diff, event, confd)))
|
||||
if ((rc = dhcpv6_client_change(session, config, diff, event, confd)))
|
||||
goto free_diff;
|
||||
|
||||
/* ietf-keystore */
|
||||
if ((rc = ietf_keystore_change(session, config, diff, event, confd)))
|
||||
if ((rc = keystore_change(session, config, diff, event, confd)))
|
||||
goto free_diff;
|
||||
|
||||
/* infix-services */
|
||||
if ((rc = infix_services_change(session, config, diff, event, confd)))
|
||||
if ((rc = services_change(session, config, diff, event, confd)))
|
||||
goto free_diff;
|
||||
|
||||
/* ietf-syslog*/
|
||||
if ((rc = ietf_syslog_change(session, config, diff, event, confd)))
|
||||
if ((rc = syslog_change(session, config, diff, event, confd)))
|
||||
goto free_diff;
|
||||
|
||||
/* ietf-system */
|
||||
if ((rc = ietf_system_change(session, config, diff, event, confd)))
|
||||
if ((rc = system_change(session, config, diff, event, confd)))
|
||||
goto free_diff;
|
||||
|
||||
/* infix-containers */
|
||||
#ifdef CONTAINERS
|
||||
if ((rc = infix_containers_change(session, config, diff, event, confd)))
|
||||
if ((rc = containers_change(session, config, diff, event, confd)))
|
||||
goto free_diff;
|
||||
#endif
|
||||
|
||||
/* ietf-hardware */
|
||||
if ((rc = ietf_hardware_change(session, config, diff, event, confd)))
|
||||
if ((rc = hardware_change(session, config, diff, event, confd)))
|
||||
goto free_diff;
|
||||
|
||||
/* ietf-routing */
|
||||
if ((rc = ietf_routing_change(session, config, diff, event, confd)))
|
||||
if ((rc = routing_change(session, config, diff, event, confd)))
|
||||
goto free_diff;
|
||||
|
||||
/* infix-dhcp-server */
|
||||
if ((rc = infix_dhcp_server_change(session, config, diff, event, confd)))
|
||||
if ((rc = dhcp_server_change(session, config, diff, event, confd)))
|
||||
goto free_diff;
|
||||
|
||||
/* infix-firewall */
|
||||
if ((rc = infix_firewall_change(session, config, diff, event, confd)))
|
||||
if ((rc = firewall_change(session, config, diff, event, confd)))
|
||||
goto free_diff;
|
||||
|
||||
/* infix-meta */
|
||||
if ((rc = infix_meta_change_cb(session, config, diff, event, confd)))
|
||||
if ((rc = meta_change_cb(session, config, diff, event, confd)))
|
||||
goto free_diff;
|
||||
|
||||
if (cfg)
|
||||
@@ -390,48 +390,48 @@ int sr_plugin_init_cb(sr_session_ctx_t *session, void **priv)
|
||||
goto err;
|
||||
}
|
||||
|
||||
rc = ietf_system_rpc_init(&confd);
|
||||
rc = system_rpc_init(&confd);
|
||||
if (rc)
|
||||
goto err;
|
||||
#ifdef CONTAINERS
|
||||
rc = infix_containers_rpc_init(&confd);
|
||||
rc = containers_rpc_init(&confd);
|
||||
if (rc)
|
||||
goto err;
|
||||
#endif
|
||||
rc = infix_dhcp_server_rpc_init(&confd);
|
||||
rc = dhcp_server_rpc_init(&confd);
|
||||
if (rc)
|
||||
goto err;
|
||||
|
||||
rc = infix_factory_rpc_init(&confd);
|
||||
rc = factory_rpc_init(&confd);
|
||||
if (rc)
|
||||
goto err;
|
||||
|
||||
rc = ietf_factory_default_rpc_init(&confd);
|
||||
rc = factory_default_rpc_init(&confd);
|
||||
if (rc)
|
||||
goto err;
|
||||
|
||||
rc = infix_firewall_rpc_init(&confd);
|
||||
rc = firewall_rpc_init(&confd);
|
||||
if (rc)
|
||||
goto err;
|
||||
|
||||
rc = infix_system_sw_rpc_init(&confd);
|
||||
rc = system_sw_rpc_init(&confd);
|
||||
if (rc)
|
||||
goto err;
|
||||
|
||||
/* Candidate infer configurations */
|
||||
rc = ietf_interfaces_cand_init(&confd);
|
||||
rc = interfaces_cand_init(&confd);
|
||||
if (rc)
|
||||
goto err;
|
||||
|
||||
rc = ietf_hardware_candidate_init(&confd);
|
||||
rc = hardware_candidate_init(&confd);
|
||||
if (rc)
|
||||
goto err;
|
||||
|
||||
rc = infix_firewall_candidate_init(&confd);
|
||||
rc = firewall_candidate_init(&confd);
|
||||
if (rc)
|
||||
goto err;
|
||||
|
||||
rc = infix_dhcp_server_candidate_init(&confd);
|
||||
rc = dhcp_server_candidate_init(&confd);
|
||||
if (rc)
|
||||
goto err;
|
||||
/* YOUR_INIT GOES HERE */
|
||||
|
||||
@@ -183,68 +183,68 @@ static inline int register_rpc(sr_session_ctx_t *session, const char *xpath,
|
||||
}
|
||||
|
||||
|
||||
/* ietf-interfaces.c */
|
||||
int ietf_interfaces_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
int ietf_interfaces_cand_init(struct confd *confd);
|
||||
/* interfaces.c */
|
||||
int interfaces_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
int interfaces_cand_init(struct confd *confd);
|
||||
|
||||
/* ietf-syslog.c */
|
||||
int ietf_syslog_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
/* syslog.c */
|
||||
int syslog_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
|
||||
/* ietf-system.c */
|
||||
int ietf_system_rpc_init (struct confd *confd);
|
||||
/* system.c */
|
||||
int system_rpc_init (struct confd *confd);
|
||||
int hostnamefmt (struct confd *confd, const char *fmt, char *hostnm, size_t hostlen, char *domain, size_t domlen);
|
||||
int ietf_system_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
int system_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
|
||||
/* infix-containers.c */
|
||||
/* containers.c */
|
||||
#ifdef CONTAINERS
|
||||
int infix_containers_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
int infix_containers_rpc_init(struct confd *confd);
|
||||
int containers_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
int containers_rpc_init(struct confd *confd);
|
||||
#else
|
||||
static inline int infix_containers_rpc_init(struct confd *confd) { return 0; }
|
||||
static inline int infix_containers_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd) { return 0; }
|
||||
static inline int containers_rpc_init(struct confd *confd) { return 0; }
|
||||
static inline int containers_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd) { return 0; }
|
||||
#endif
|
||||
|
||||
/* infix-dhcp-client.c */
|
||||
int infix_dhcp_client_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
/* dhcp-client.c */
|
||||
int dhcp_client_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
|
||||
/* infix-dhcpv6-client.c */
|
||||
int infix_dhcpv6_client_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
/* dhcpv6-client.c */
|
||||
int dhcpv6_client_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
|
||||
/* infix-dhcp-server.c */
|
||||
int infix_dhcp_server_candidate_init(struct confd *confd);
|
||||
int infix_dhcp_server_rpc_init(struct confd *confd);
|
||||
int infix_dhcp_server_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
/* dhcp-server.c */
|
||||
int dhcp_server_candidate_init(struct confd *confd);
|
||||
int dhcp_server_rpc_init(struct confd *confd);
|
||||
int dhcp_server_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
|
||||
/* ietf-routing */
|
||||
int ietf_routing_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
int routing_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
|
||||
/* infix-factory.c */
|
||||
int infix_factory_rpc_init(struct confd *confd);
|
||||
/* factory.c */
|
||||
int factory_rpc_init(struct confd *confd);
|
||||
|
||||
/* ietf-factory-default */
|
||||
int ietf_factory_default_rpc_init(struct confd *confd);
|
||||
int factory_default_rpc_init(struct confd *confd);
|
||||
|
||||
/* infix-meta.c */
|
||||
int infix_meta_change_cb(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
/* meta.c */
|
||||
int meta_change_cb(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
|
||||
/* infix-system-software.c */
|
||||
int infix_system_sw_rpc_init(struct confd *confd);
|
||||
/* system-software.c */
|
||||
int system_sw_rpc_init(struct confd *confd);
|
||||
|
||||
/* infix-services.c */
|
||||
int infix_services_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
/* services.c */
|
||||
int services_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
|
||||
/* ietf-hardware.c */
|
||||
int ietf_hardware_candidate_init(struct confd *confd);
|
||||
int ietf_hardware_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
/* hardware.c */
|
||||
int hardware_candidate_init(struct confd *confd);
|
||||
int hardware_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
|
||||
/* ietf-keystore.c */
|
||||
/* keystore.c */
|
||||
#define SSH_HOSTKEYS "/etc/ssh/hostkeys"
|
||||
#define SSH_HOSTKEYS_NEXT SSH_HOSTKEYS"+"
|
||||
int ietf_keystore_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
int keystore_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
|
||||
/* infix-firewall.c */
|
||||
int infix_firewall_rpc_init(struct confd *confd);
|
||||
int infix_firewall_candidate_init(struct confd *confd);
|
||||
int infix_firewall_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
/* firewall.c */
|
||||
int firewall_rpc_init(struct confd *confd);
|
||||
int firewall_candidate_init(struct confd *confd);
|
||||
int firewall_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd);
|
||||
|
||||
#endif /* CONFD_CORE_H_ */
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <srx/srx_val.h>
|
||||
|
||||
#include "core.h"
|
||||
#include "infix-dhcp-common.h"
|
||||
#include "dhcp-common.h"
|
||||
|
||||
#define ARPING_MSEC 1000
|
||||
#define MODULE "infix-dhcp-client"
|
||||
@@ -167,7 +167,7 @@ static void del(const char *ifname)
|
||||
systemf("initctl -bfq delete dhcp-client-%s", ifname);
|
||||
}
|
||||
|
||||
int infix_dhcp_client_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff,
|
||||
int dhcp_client_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff,
|
||||
sr_event_t event, struct confd *confd)
|
||||
{
|
||||
struct lyd_node *ifaces, *difaces, *iface, *diface, *ipv4, *dhcp, *ddhcp;
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include <libyang/libyang.h>
|
||||
#include "core.h"
|
||||
#include "infix-dhcp-common.h"
|
||||
#include "dhcp-common.h"
|
||||
|
||||
int dhcp_option_lookup(const struct lyd_node *id)
|
||||
{
|
||||
@@ -230,7 +230,7 @@ static void infer_options_v6(sr_session_ctx_t *session, const char *xpath)
|
||||
}
|
||||
|
||||
/*
|
||||
* Called from ietf-interfaces.c ifchange_cand() to infer DHCP options
|
||||
* Called from interfaces.c ifchange_cand() to infer DHCP options
|
||||
* for both DHCPv4 and DHCPv6 client configurations
|
||||
*/
|
||||
int ifchange_cand_infer_dhcp(sr_session_ctx_t *session, const char *xpath)
|
||||
@@ -1,7 +1,7 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause */
|
||||
|
||||
#ifndef INFIX_DHCP_COMMON_H_
|
||||
#define INFIX_DHCP_COMMON_H_
|
||||
#ifndef DHCP_COMMON_H_
|
||||
#define DHCP_COMMON_H_
|
||||
|
||||
#include <libyang/libyang.h>
|
||||
|
||||
@@ -16,4 +16,4 @@ char *dhcp_compose_options(struct lyd_node *cfg, const char *ifname, char **opti
|
||||
struct lyd_node *id, const char *val, const char *hex,
|
||||
char *(*ip_cache_cb)(const char *, char *, size_t));
|
||||
|
||||
#endif /* INFIX_DHCP_COMMON_H_ */
|
||||
#endif /* DHCP_COMMON_H_ */
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <srx/srx_val.h>
|
||||
|
||||
#include "core.h"
|
||||
#include "infix-dhcp-common.h"
|
||||
#include "dhcp-common.h"
|
||||
|
||||
#define MODULE "infix-dhcp-server"
|
||||
#define ROOT_XPATH "/infix-dhcp-server:"
|
||||
@@ -295,7 +295,7 @@ static void del(const char *subnet, struct lyd_node *cfg)
|
||||
ERRNO("Failed switching to new %s", DNSMASQ_LEASES);
|
||||
}
|
||||
|
||||
int infix_dhcp_server_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd)
|
||||
int dhcp_server_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd)
|
||||
{
|
||||
struct lyd_node *global, *cifs, *difs, *cif, *dif;
|
||||
int enabled = 0, added = 0, deleted = 0;
|
||||
@@ -450,7 +450,7 @@ static int clear_stats(sr_session_ctx_t *session, uint32_t sub_id, const char *x
|
||||
return SR_ERR_OK;
|
||||
}
|
||||
|
||||
int infix_dhcp_server_candidate_init(struct confd *confd)
|
||||
int dhcp_server_candidate_init(struct confd *confd)
|
||||
{
|
||||
int rc;
|
||||
|
||||
@@ -462,7 +462,7 @@ fail:
|
||||
return rc;
|
||||
}
|
||||
|
||||
int infix_dhcp_server_rpc_init(struct confd *confd)
|
||||
int dhcp_server_rpc_init(struct confd *confd)
|
||||
{
|
||||
int rc;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <srx/srx_val.h>
|
||||
|
||||
#include "core.h"
|
||||
#include "infix-dhcp-common.h"
|
||||
#include "dhcp-common.h"
|
||||
|
||||
#define MODULE "infix-dhcpv6-client"
|
||||
#define XPATH "/ietf-interfaces:interfaces/interface/ietf-ip:ipv6/infix-dhcpv6-client:dhcp"
|
||||
@@ -112,7 +112,7 @@ static void del_v6(const char *ifname)
|
||||
systemf("initctl -bfq delete dhcpv6-client-%s", ifname);
|
||||
}
|
||||
|
||||
int infix_dhcpv6_client_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff,
|
||||
int dhcpv6_client_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff,
|
||||
sr_event_t event, struct confd *confd)
|
||||
{
|
||||
struct lyd_node *ifaces, *difaces, *iface, *diface, *ipv6, *dhcp, *ddhcp;
|
||||
@@ -16,7 +16,7 @@ static int factory_reset(sr_session_ctx_t *session, uint32_t sub_id, const char
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ietf_factory_default_rpc_init(struct confd *confd)
|
||||
int factory_default_rpc_init(struct confd *confd)
|
||||
{
|
||||
int rc;
|
||||
|
||||
@@ -33,7 +33,7 @@ static int rpc(sr_session_ctx_t *session, uint32_t sub_id, const char *xpath,
|
||||
return rc;
|
||||
}
|
||||
|
||||
int infix_factory_rpc_init(struct confd *confd)
|
||||
int factory_rpc_init(struct confd *confd)
|
||||
{
|
||||
int rc;
|
||||
REGISTER_RPC(confd->session, "/infix-factory-default:factory-default", rpc, NULL, &confd->fsub);
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <libyang/libyang.h>
|
||||
|
||||
#include "core.h"
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
#define MODULE "infix-firewall"
|
||||
#define XPATH "/infix-firewall:firewall"
|
||||
@@ -480,7 +480,7 @@ static int infer_policy(sr_session_ctx_t *session, const char *name, const char
|
||||
}
|
||||
#endif
|
||||
|
||||
int infix_firewall_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd)
|
||||
int firewall_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd)
|
||||
{
|
||||
struct lyd_node *tree, *global;
|
||||
struct lyd_node *clist, *cnode;
|
||||
@@ -534,7 +534,7 @@ int infix_firewall_change(sr_session_ctx_t *session, struct lyd_node *config, st
|
||||
}
|
||||
|
||||
/* Get L3 interfaces for default zone assignment */
|
||||
if (ietf_interfaces_get_all_l3(tree, &ifaces) != 0) {
|
||||
if (interfaces_get_all_l3(tree, &ifaces) != 0) {
|
||||
ERROR("Failed to get L3 interfaces");
|
||||
ifaces = NULL;
|
||||
}
|
||||
@@ -711,7 +711,7 @@ static int lockdown(sr_session_ctx_t *session, uint32_t sub_id, const char *xpat
|
||||
return SR_ERR_OK;
|
||||
}
|
||||
|
||||
int infix_firewall_rpc_init(struct confd *confd)
|
||||
int firewall_rpc_init(struct confd *confd)
|
||||
{
|
||||
int rc;
|
||||
|
||||
@@ -724,7 +724,7 @@ fail:
|
||||
}
|
||||
|
||||
|
||||
int infix_firewall_candidate_init(struct confd *confd)
|
||||
int firewall_candidate_init(struct confd *confd)
|
||||
{
|
||||
int rc;
|
||||
|
||||
@@ -185,7 +185,7 @@ static int hardware_cand(sr_session_ctx_t *session, uint32_t sub_id, const char
|
||||
return err;
|
||||
}
|
||||
|
||||
int ietf_hardware_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd)
|
||||
int hardware_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd)
|
||||
{
|
||||
struct lyd_node *difs = NULL, *dif = NULL, *cifs = NULL, *cif = NULL;
|
||||
int rc = SR_ERR_OK;
|
||||
@@ -232,7 +232,7 @@ int ietf_hardware_change(sr_session_ctx_t *session, struct lyd_node *config, str
|
||||
err:
|
||||
return rc;
|
||||
}
|
||||
int ietf_hardware_candidate_init(struct confd *confd)
|
||||
int hardware_candidate_init(struct confd *confd)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <srx/lyx.h>
|
||||
#include <srx/srx_val.h>
|
||||
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
static bool iface_uses_autoneg(struct lyd_node *cif)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <srx/lyx.h>
|
||||
#include <srx/srx_val.h>
|
||||
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
static int gen_vlan(struct lyd_node *cif, struct lyd_node *vlan, FILE *conf)
|
||||
{
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <srx/lyx.h>
|
||||
#include <srx/srx_val.h>
|
||||
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
static const char *mstpd_cost_str(struct lyd_node *cost)
|
||||
{
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <srx/lyx.h>
|
||||
#include <srx/srx_val.h>
|
||||
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
struct ixif_br {
|
||||
const char *name;
|
||||
@@ -1,7 +1,7 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause */
|
||||
#include <srx/lyx.h>
|
||||
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
int gre_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip)
|
||||
{
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <srx/lyx.h>
|
||||
#include <srx/srx_val.h>
|
||||
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
/*
|
||||
* The lag-port noode is only in the dif at initial creation, or removal.
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <srx/lyx.h>
|
||||
#include <srx/srx_val.h>
|
||||
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
/*
|
||||
* While the kernel atomically creates/destroys the pair, in `running`
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <srx/lyx.h>
|
||||
#include <srx/srx_val.h>
|
||||
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
int ifchange_cand_infer_vlan(sr_session_ctx_t *session, const char *path)
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause */
|
||||
#include <srx/lyx.h>
|
||||
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
int vxlan_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip)
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause */
|
||||
#include <srx/lyx.h>
|
||||
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
#define WPA_SUPPLICANT_FINIT_CONF "/etc/finit.d/available/wpa_supplicant-%s.conf"
|
||||
#define WPA_SUPPLICANT_CONF "/etc/wpa_supplicant-%s.conf"
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <srx/srx_val.h>
|
||||
#include <libyang/libyang.h>
|
||||
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
#define IFACE_PROBE_TIMEOUT 40
|
||||
|
||||
|
||||
@@ -791,7 +791,7 @@ static sr_error_t ifchange_post(sr_session_ctx_t *session, struct dagger *net,
|
||||
return err ? SR_ERR_INTERNAL : SR_ERR_OK;
|
||||
}
|
||||
|
||||
int ietf_interfaces_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd)
|
||||
int interfaces_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd)
|
||||
{
|
||||
struct lyd_node *cifs, *difs, *cif, *dif;
|
||||
sr_error_t err;
|
||||
@@ -839,7 +839,7 @@ err_out:
|
||||
return err;
|
||||
}
|
||||
|
||||
int ietf_interfaces_get_all_l3(const struct lyd_node *tree, char ***ifaces)
|
||||
int interfaces_get_all_l3(const struct lyd_node *tree, char ***ifaces)
|
||||
{
|
||||
struct lyd_node *interfaces, *cif;
|
||||
char **names = NULL;
|
||||
@@ -905,7 +905,7 @@ int ietf_interfaces_get_all_l3(const struct lyd_node *tree, char ***ifaces)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ietf_interfaces_cand_init(struct confd *confd)
|
||||
int interfaces_cand_init(struct confd *confd)
|
||||
{
|
||||
int rc = SR_ERR_OK;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause */
|
||||
|
||||
#ifndef CONFD_IETF_INTERFACES_H_
|
||||
#define CONFD_IETF_INTERFACES_H_
|
||||
#ifndef CONFD_INTERFACES_H_
|
||||
#define CONFD_INTERFACES_H_
|
||||
|
||||
#include "core.h"
|
||||
#include "cni.h"
|
||||
@@ -99,12 +99,12 @@ bool iface_has_quirk(const char *ifname, const char *quirkname);
|
||||
/* ieee802-ethernet-interface.c */
|
||||
int netdag_gen_ethtool(struct dagger *net, struct lyd_node *cif, struct lyd_node *dif);
|
||||
|
||||
/* ietf-interfaces.c */
|
||||
/* interfaces.c */
|
||||
const char *get_chassis_addr(void);
|
||||
int link_gen_address(struct lyd_node *cif, FILE *ip);
|
||||
int ietf_interfaces_get_all_l3(const struct lyd_node *tree, char ***ifaces);
|
||||
int interfaces_get_all_l3(const struct lyd_node *tree, char ***ifaces);
|
||||
|
||||
/* ietf-ip.c */
|
||||
/* ip.c */
|
||||
int netdag_gen_ipv6_autoconf(struct dagger *net, struct lyd_node *cif,
|
||||
struct lyd_node *dif, FILE *ip);
|
||||
int netdag_gen_ipv4_autoconf(struct dagger *net, struct lyd_node *cif,
|
||||
@@ -112,42 +112,42 @@ int netdag_gen_ipv4_autoconf(struct dagger *net, struct lyd_node *cif,
|
||||
int netdag_gen_ip_addrs(struct dagger *net, FILE *ip, const char *proto,
|
||||
struct lyd_node *cif, struct lyd_node *dif);
|
||||
|
||||
/* infix-if-bridge.c */
|
||||
/* if-bridge.c */
|
||||
int bridge_mstpd_gen(struct lyd_node *cifs);
|
||||
int bridge_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip, int add);
|
||||
int bridge_add_deps(struct lyd_node *cif);
|
||||
/* infix-if-bridge-mcd.c */
|
||||
/* if-bridge-mcd.c */
|
||||
int bridge_mcd_gen(struct lyd_node *cifs);
|
||||
/* infix-if-bridge-port.c */
|
||||
/* if-bridge-port.c */
|
||||
int bridge_port_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip);
|
||||
|
||||
/* infix-if-wifi.c */
|
||||
/* if-wifi.c */
|
||||
int wifi_gen(struct lyd_node *dif, struct lyd_node *cif, struct dagger *net);
|
||||
int wifi_gen_del(struct lyd_node *dif, struct dagger *net);
|
||||
|
||||
/* infix-if-gre.c */
|
||||
/* if-gre.c */
|
||||
int gre_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip);
|
||||
|
||||
/* infix-if-lag.c */
|
||||
/* if-lag.c */
|
||||
int lag_port_gen(struct lyd_node *dif, struct lyd_node *cif);
|
||||
int lag_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip, int add);
|
||||
int lag_add_deps(struct lyd_node *cif);
|
||||
|
||||
/* infix-if-veth.c */
|
||||
/* if-veth.c */
|
||||
bool veth_is_primary(struct lyd_node *cif);
|
||||
int ifchange_cand_infer_veth(sr_session_ctx_t *session, const char *path);
|
||||
int veth_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip);
|
||||
int veth_add_deps(struct lyd_node *cif);
|
||||
|
||||
/* infix-if-vlan.c */
|
||||
/* if-vlan.c */
|
||||
int ifchange_cand_infer_vlan(sr_session_ctx_t *session, const char *path);
|
||||
int vlan_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip);
|
||||
int vlan_add_deps(struct lyd_node *cif);
|
||||
|
||||
/* infix-dhcp-common.c */
|
||||
/* dhcp-common.c */
|
||||
int ifchange_cand_infer_dhcp(sr_session_ctx_t *session, const char *path);
|
||||
|
||||
/* infix-if-vxlan.c */
|
||||
/* if-vxlan.c */
|
||||
int vxlan_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip);
|
||||
|
||||
#endif /* CONFD_IETF_INTERFACES_H_ */
|
||||
#endif /* CONFD_INTERFACES_H_ */
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <srx/lyx.h>
|
||||
#include <srx/srx_val.h>
|
||||
|
||||
#include "ietf-interfaces.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
int netdag_gen_ipv6_autoconf(struct dagger *net, struct lyd_node *cif,
|
||||
struct lyd_node *dif, FILE *ip)
|
||||
@@ -155,7 +155,7 @@ static int keystore_update(sr_session_ctx_t *session, struct lyd_node *config, s
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ietf_keystore_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff,
|
||||
int keystore_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff,
|
||||
sr_event_t event, struct confd *confd)
|
||||
{
|
||||
struct lyd_node *changes, *change;
|
||||
@@ -18,7 +18,7 @@ static int set_version(sr_session_ctx_t *session)
|
||||
return SR_ERR_OK;
|
||||
}
|
||||
|
||||
int infix_meta_change_cb(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd)
|
||||
int meta_change_cb(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd)
|
||||
{
|
||||
if (event == SR_EV_UPDATE)
|
||||
return set_version(session);
|
||||
@@ -0,0 +1,156 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause */
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <net/if.h> /* IFNAMSIZ */
|
||||
#include <sys/socket.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
#include <poll.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define NL_BUFSZ 4096
|
||||
|
||||
#define dbg(fmt, args...) if (nl_debug) warnx(fmt, ##args)
|
||||
#define log(fmt, args...) warnx(fmt, ##args)
|
||||
|
||||
static int nl_debug;
|
||||
static char *nl_buf;
|
||||
|
||||
static void scpy(char *dst, const char *src, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
if (src[i] == 0)
|
||||
break;
|
||||
dst[i] = src[i];
|
||||
}
|
||||
|
||||
if (i < len)
|
||||
dst[i] = 0;
|
||||
else
|
||||
dst[len - 1] = 0;
|
||||
}
|
||||
|
||||
static int nlmsg_validate(struct nlmsghdr *nlmsg, ssize_t len)
|
||||
{
|
||||
ssize_t la;
|
||||
|
||||
if (nlmsg->nlmsg_len < NLMSG_LENGTH(sizeof(struct ifinfomsg)))
|
||||
return - 1; /* Packet too small or truncated! */
|
||||
|
||||
la = NLMSG_PAYLOAD(nlmsg, sizeof(struct ifinfomsg));
|
||||
if (la >= len)
|
||||
return -1; /* Packet too large! */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nl_link(struct nlmsghdr *nlmsg, ssize_t len)
|
||||
{
|
||||
char ifname[IFNAMSIZ];
|
||||
struct ifinfomsg *i;
|
||||
struct rtattr *a;
|
||||
ssize_t la;
|
||||
|
||||
i = NLMSG_DATA(nlmsg);
|
||||
a = (struct rtattr *)((char *)i + NLMSG_ALIGN(sizeof(struct ifinfomsg)));
|
||||
la = NLMSG_PAYLOAD(nlmsg, sizeof(struct ifinfomsg));
|
||||
|
||||
for (; RTA_OK(a, la); a = RTA_NEXT(a, la)) {
|
||||
if (a->rta_type != IFLA_IFNAME)
|
||||
continue;
|
||||
|
||||
scpy(ifname, RTA_DATA(a), sizeof(ifname));
|
||||
|
||||
switch (nlmsg->nlmsg_type) {
|
||||
case RTM_NEWLINK:
|
||||
dbg("%s: new link or IFF change, flags 0x%x, change 0x%x", ifname, i->ifi_flags, i->ifi_change);
|
||||
return 1;
|
||||
case RTM_DELLINK:
|
||||
dbg("%s: delete link", ifname);
|
||||
return 1;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nl_callback(int sd)
|
||||
{
|
||||
while (1) {
|
||||
struct nlmsghdr *nh;
|
||||
ssize_t len;
|
||||
size_t l;
|
||||
|
||||
while ((len = recv(sd, nl_buf, NL_BUFSZ, 0)) < 0) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
l = (size_t)len;
|
||||
for (nh = (struct nlmsghdr *)nl_buf; NLMSG_OK(nh, l); nh = NLMSG_NEXT(nh, l)) {
|
||||
switch (nh->nlmsg_type) {
|
||||
case RTM_NEWLINK:
|
||||
case RTM_DELLINK:
|
||||
if (nlmsg_validate(nh, len))
|
||||
continue;
|
||||
return nl_link(nh, len);
|
||||
case NLMSG_DONE:
|
||||
case NLMSG_ERROR:
|
||||
return 0;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
struct sockaddr_nl sa = { 0 };
|
||||
struct pollfd pfd;
|
||||
int sd;
|
||||
|
||||
sd = socket(AF_NETLINK, SOCK_RAW | SOCK_NONBLOCK | SOCK_CLOEXEC, NETLINK_ROUTE);
|
||||
if (sd < 0)
|
||||
err(1, "socket()");
|
||||
|
||||
sa.nl_family = AF_NETLINK;
|
||||
sa.nl_groups = RTMGRP_IPV4_ROUTE | RTMGRP_LINK;
|
||||
sa.nl_pid = getpid();
|
||||
|
||||
if (bind(sd, (struct sockaddr *)&sa, sizeof(sa)) < 0)
|
||||
err(1, "bind()");
|
||||
|
||||
nl_buf = malloc(NL_BUFSZ);
|
||||
if (!nl_buf)
|
||||
err(1, "malloc()");
|
||||
|
||||
pfd.fd = sd;
|
||||
pfd.events = POLLIN;
|
||||
while (1) {
|
||||
int rc;
|
||||
|
||||
rc = poll(&pfd, 1, -1);
|
||||
if (rc == -1)
|
||||
break;
|
||||
|
||||
if (nl_callback(sd))
|
||||
log("link change");
|
||||
}
|
||||
|
||||
return !!close(sd);
|
||||
}
|
||||
@@ -247,7 +247,7 @@ static int parse_static_routes(sr_session_ctx_t *session, struct lyd_node *paren
|
||||
return num_routes;
|
||||
}
|
||||
|
||||
int ietf_routing_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd)
|
||||
int routing_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd)
|
||||
{
|
||||
int staticd_enabled = 0, ospfd_enabled = 0, bfdd_enabled = 0;
|
||||
struct lyd_node *cplane, *cplanes;
|
||||
@@ -515,7 +515,7 @@ static int web_change(sr_session_ctx_t *session, struct lyd_node *config, struct
|
||||
return put(cfg);
|
||||
}
|
||||
|
||||
int infix_services_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd)
|
||||
int services_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd)
|
||||
{
|
||||
int rc;
|
||||
|
||||
@@ -463,7 +463,7 @@ done:
|
||||
return SR_ERR_OK;
|
||||
}
|
||||
|
||||
int ietf_syslog_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd)
|
||||
int syslog_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd)
|
||||
{
|
||||
int rc = SR_ERR_OK;
|
||||
|
||||
@@ -89,7 +89,7 @@ static int infix_system_sw_set_boot_order(sr_session_ctx_t *session, uint32_t su
|
||||
return SR_ERR_OK;
|
||||
}
|
||||
|
||||
int infix_system_sw_rpc_init(struct confd *confd)
|
||||
int system_sw_rpc_init(struct confd *confd)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
@@ -1602,7 +1602,7 @@ static int change_hostname(sr_session_ctx_t *session, struct lyd_node *config, s
|
||||
}
|
||||
|
||||
|
||||
int ietf_system_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd)
|
||||
int system_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd)
|
||||
{
|
||||
int rc = SR_ERR_OK;
|
||||
|
||||
@@ -1628,7 +1628,7 @@ int ietf_system_change(sr_session_ctx_t *session, struct lyd_node *config, struc
|
||||
return SR_ERR_OK;
|
||||
}
|
||||
|
||||
int ietf_system_rpc_init(struct confd *confd)
|
||||
int system_rpc_init(struct confd *confd)
|
||||
{
|
||||
int rc;
|
||||
|
||||
@@ -18,37 +18,37 @@
|
||||
suite: misc/all.yaml
|
||||
|
||||
|
||||
- name: "IETF System"
|
||||
suite: ietf_system/all.yaml
|
||||
- name: "System"
|
||||
suite: system/all.yaml
|
||||
|
||||
# Upgrade may leave wrong boot order
|
||||
- case: meta/bootorder.py
|
||||
infamy:
|
||||
specification: False
|
||||
|
||||
- name: "IETF Syslog"
|
||||
suite: ietf_syslog/all.yaml
|
||||
- name: "Syslog"
|
||||
suite: syslog/all.yaml
|
||||
|
||||
- name: "IETF Interfaces"
|
||||
suite: ietf_interfaces/all.yaml
|
||||
- name: "Interfaces"
|
||||
suite: interfaces/all.yaml
|
||||
|
||||
- name: "IETF Routing"
|
||||
suite: ietf_routing/all.yaml
|
||||
- name: "Routing"
|
||||
suite: routing/all.yaml
|
||||
|
||||
- name: "Infix Firewall"
|
||||
suite: infix_firewall/all.yaml
|
||||
- name: "Firewall"
|
||||
suite: firewall/all.yaml
|
||||
|
||||
- name: "Infix Containers"
|
||||
suite: infix_containers/all.yaml
|
||||
- name: "Containers"
|
||||
suite: containers/all.yaml
|
||||
|
||||
- name: "Infix DHCP"
|
||||
suite: infix_dhcp/all.yaml
|
||||
- name: "DHCP"
|
||||
suite: dhcp/all.yaml
|
||||
|
||||
- name: "IETF Hardware"
|
||||
suite: ietf_hardware/all.yaml
|
||||
- name: "Hardware"
|
||||
suite: hardware/all.yaml
|
||||
|
||||
- name: "Infix Services"
|
||||
suite: infix_services/all.yaml
|
||||
- name: "Services"
|
||||
suite: services/all.yaml
|
||||
|
||||
- name: "Use Case Tests"
|
||||
suite: use_case/all.yaml
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
:testgroup:
|
||||
== infix-containers
|
||||
== Containers
|
||||
|
||||
Tests verifying Infix Docker container support:
|
||||
Tests verifying link:https://opencontainers.org/[OCI container] support:
|
||||
|
||||
- Basic web server container running in host network mode
|
||||
- Container enable/disable functionality via configuration
|
||||
@@ -1,6 +1,6 @@
|
||||
=== Container basic
|
||||
|
||||
ifdef::topdoc[:imagesdir: {topdoc}../../test/case/infix_containers/basic]
|
||||
ifdef::topdoc[:imagesdir: {topdoc}../../test/case/containers/basic]
|
||||
|
||||
==== Description
|
||||
|
||||
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
@@ -1,6 +1,6 @@
|
||||
=== Container with bridge network
|
||||
|
||||
ifdef::topdoc[:imagesdir: {topdoc}../../test/case/infix_containers/bridge]
|
||||
ifdef::topdoc[:imagesdir: {topdoc}../../test/case/containers/bridge]
|
||||
|
||||
==== Description
|
||||
|
||||
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
@@ -1,6 +1,6 @@
|
||||
=== Container enabled/disabled
|
||||
|
||||
ifdef::topdoc[:imagesdir: {topdoc}../../test/case/infix_containers/enabled]
|
||||
ifdef::topdoc[:imagesdir: {topdoc}../../test/case/containers/enabled]
|
||||
|
||||
==== Description
|
||||
|
||||
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
@@ -1,6 +1,6 @@
|
||||
=== Container environment variables
|
||||
|
||||
ifdef::topdoc[:imagesdir: {topdoc}../../test/case/infix_containers/environment]
|
||||
ifdef::topdoc[:imagesdir: {topdoc}../../test/case/containers/environment]
|
||||
|
||||
==== Description
|
||||
|
||||
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
@@ -1,6 +1,6 @@
|
||||
=== Basic Firewall Container
|
||||
|
||||
ifdef::topdoc[:imagesdir: {topdoc}../../test/case/infix_containers/firewall_basic]
|
||||
ifdef::topdoc[:imagesdir: {topdoc}../../test/case/containers/firewall_basic]
|
||||
|
||||
==== Description
|
||||
|
||||
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
@@ -1,12 +1,13 @@
|
||||
=== Host Command Execution from Container
|
||||
|
||||
ifdef::topdoc[:imagesdir: {topdoc}../../test/case/infix_containers/host_commands]
|
||||
ifdef::topdoc[:imagesdir: {topdoc}../../test/case/containers/host_commands]
|
||||
|
||||
==== Description
|
||||
|
||||
This test verifies that a container running on Infix can execute commands
|
||||
that affect the host system. Specifically, it confirms that the container
|
||||
can change the hostname of the host.
|
||||
This test verifies that a container in privileged mode can break out of
|
||||
the container to execute commands that affect the host system.
|
||||
Specifically, it confirms that the container can change the hostname of
|
||||
the host.
|
||||
|
||||
==== Topology
|
||||
|
||||
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
@@ -1,6 +1,6 @@
|
||||
=== Container with physical interface
|
||||
|
||||
ifdef::topdoc[:imagesdir: {topdoc}../../test/case/infix_containers/phys]
|
||||
ifdef::topdoc[:imagesdir: {topdoc}../../test/case/containers/phys]
|
||||
|
||||
==== Description
|
||||
|
||||
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
@@ -1,6 +1,6 @@
|
||||
=== Container Upgrade
|
||||
|
||||
ifdef::topdoc[:imagesdir: {topdoc}../../test/case/infix_containers/upgrade]
|
||||
ifdef::topdoc[:imagesdir: {topdoc}../../test/case/containers/upgrade]
|
||||
|
||||
==== Description
|
||||
|
||||
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
@@ -1,6 +1,6 @@
|
||||
=== Container with VETH pair
|
||||
|
||||
ifdef::topdoc[:imagesdir: {topdoc}../../test/case/infix_containers/veth]
|
||||
ifdef::topdoc[:imagesdir: {topdoc}../../test/case/containers/veth]
|
||||
|
||||
==== Description
|
||||
|
||||
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
@@ -1,6 +1,6 @@
|
||||
=== Container Volume Persistence
|
||||
|
||||
ifdef::topdoc[:imagesdir: {topdoc}../../test/case/infix_containers/volume]
|
||||
ifdef::topdoc[:imagesdir: {topdoc}../../test/case/containers/volume]
|
||||
|
||||
==== Description
|
||||
|
||||
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
@@ -1,7 +1,7 @@
|
||||
:testgroup:
|
||||
== infix-dhcp
|
||||
== DHCP
|
||||
|
||||
Tests verifying DHCPv4/DHCPv6 client and server functionality in Infix:
|
||||
Tests verifying DHCPv4/DHCPv6 client and server functionality:
|
||||
|
||||
- Basic DHCPv4 client lease acquisition and configuration
|
||||
- DHCPv4 client with default gateway assignment
|
||||