diff --git a/board/common/rootfs/var/clixon/.empty b/board/common/rootfs/var/clixon/.empty new file mode 100644 index 00000000..e69de29b diff --git a/board/common/users b/board/common/users index a4f05e6e..f94eb55e 100644 --- a/board/common/users +++ b/board/common/users @@ -1 +1,3 @@ +clixon -1 clixon -1 * - - wheel Clixon backend factory -1 wheel -1 =reset - /sbin/factory - Reset to factory defaults + diff --git a/package/Config.in b/package/Config.in index 120d48f8..d9ea3234 100644 --- a/package/Config.in +++ b/package/Config.in @@ -5,6 +5,7 @@ source "$BR2_EXTERNAL_INFIX_PATH/package/finit/Config.in" source "$BR2_EXTERNAL_INFIX_PATH/package/ifupdown2/Config.in" source "$BR2_EXTERNAL_INFIX_PATH/package/ifupdown-ng/Config.in" source "$BR2_EXTERNAL_INFIX_PATH/package/mdnsd/Config.in" +source "$BR2_EXTERNAL_INFIX_PATH/package/mech/Config.in" source "$BR2_EXTERNAL_INFIX_PATH/package/python-templating/Config.in" source "$BR2_EXTERNAL_INFIX_PATH/package/skeleton-init-finit/Config.in" source "$BR2_EXTERNAL_INFIX_PATH/package/sysrepo-plugins-common/Config.in" diff --git a/package/mech/Config.in b/package/mech/Config.in new file mode 100644 index 00000000..cbd2edca --- /dev/null +++ b/package/mech/Config.in @@ -0,0 +1,6 @@ +config BR2_PACKAGE_MECH + bool "mech" + select BR2_PACKAGE_CLIXON + help + Orchestrate an Infix node using any of the front-ends + offered by Clixon, e.g. NETCONF, RESTCONF or SNMP. diff --git a/package/mech/orc.mk b/package/mech/orc.mk new file mode 100644 index 00000000..0ce71415 --- /dev/null +++ b/package/mech/orc.mk @@ -0,0 +1,12 @@ +################################################################################ +# +# mech +# +################################################################################ +MECH_VERSION = 1.0 +MECH_LICENSE = GPL +MECH_SITE_METHOD = local +MECH_SITE = $(BR2_EXTERNAL_INFIX_PATH)/src/mech +MECH_AUTORECONF = YES + +$(eval $(autotools-package)) diff --git a/src/mech/.gitignore b/src/mech/.gitignore new file mode 100644 index 00000000..e9e8e747 --- /dev/null +++ b/src/mech/.gitignore @@ -0,0 +1,33 @@ +*~ +*.o +*.la +*.lo +*.so +.deps +.libs + +/aclocal.m4 +/autom4te.cache/ +/aux +/clixon.xml +/compile +/config.h +/config.h.in +/config.guess +/config.log +/config.status +/config.sub +/configure +/depcomp +/install-sh +/libtool +/ltmain.sh +/m4 +/missing + +GPATH +GRTAGS +GTAGS +Makefile +Makefile.in + diff --git a/src/mech/Makefile.am b/src/mech/Makefile.am new file mode 100644 index 00000000..d59f99ca --- /dev/null +++ b/src/mech/Makefile.am @@ -0,0 +1,5 @@ +SUBDIRS = src yang +DISTCLEANFILES = *~ *.d +ACLOCAL_AMFLAGS = -I m4 + +sysconf_DATA = clixon.xml diff --git a/src/mech/autogen.sh b/src/mech/autogen.sh new file mode 100755 index 00000000..69ad0e18 --- /dev/null +++ b/src/mech/autogen.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +autoreconf -W portability -vifm diff --git a/src/mech/clixon.xml.in b/src/mech/clixon.xml.in new file mode 100644 index 00000000..2869cde6 --- /dev/null +++ b/src/mech/clixon.xml.in @@ -0,0 +1,26 @@ + + @SYSCONFDIR@/clixon.xml + ietf-netconf:startup + ietf-netconf:confirmed-commit + clixon-restconf:allow-auth-none + clixon-restconf:fcgi + @DATAROOTDIR@/clixon + @DATAROOTDIR@/yang + infix + exec + @LIBDIR@/clixon/backend + @LIBDIR@/clixon/netconf + @LIBDIR@/clixon/restconf + @LIBDIR@/clixon/cli + @LIBDIR@/clixon/clispec + @LOCALSTATEDIR@/clixon/backend.sock + clixon + @RUNSTATEDIR@/clixon_backend.pid + 0 + 0 + @LOCALSTATEDIR@/clixon + init + disabled + true + false + diff --git a/src/mech/common.am b/src/mech/common.am new file mode 100644 index 00000000..d92d1b95 --- /dev/null +++ b/src/mech/common.am @@ -0,0 +1,13 @@ +clixonlibdir = $(libdir)/clixon +backenddir = $(clixonlibdir)/backend +clidir = $(clixonlibdir)/cli +clispecdir = $(clixonlibdir)/clispec +yangdir = $(datarootdir)/clixon + +backend_LTLIBRARIES = +cli_LTLIBRARIES = +clispec_DATA = +yang_DATA = + +cli_libadd = -lclixon -lclixon_cli +cli_ldflags = -module -avoid-version -shared diff --git a/src/mech/configure.ac b/src/mech/configure.ac new file mode 100644 index 00000000..f2465682 --- /dev/null +++ b/src/mech/configure.ac @@ -0,0 +1,45 @@ +AC_PREREQ(2.61) +AC_INIT([orc], [1.0.0], + [https://github.com/kernelkit/infix/issues]) +AM_INIT_AUTOMAKE(1.11 foreign subdir-objects) +AM_SILENT_RULES(yes) + +LT_INIT + +AC_CONFIG_FILES([ + clixon.xml + Makefile + src/Makefile + src/core/Makefile + yang/Makefile +]) + +AC_PROG_CC +AC_PROG_INSTALL + +AC_CHECK_LIB([clixon], [yang_len_get],, AC_MSG_ERROR([Clixon not found])) + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DATAROOTDIR=`eval echo $datarootdir` +DATAROOTDIR=`eval echo $DATAROOTDIR` +AC_SUBST(DATAROOTDIR) + +LIBDIR=`eval echo $libdir` +LIBDIR=`eval echo $LIBDIR` +AC_SUBST(LIBDIR) + +LOCALSTATEDIR=`eval echo $localstatedir` +LOCALSTATEDIR=`eval echo $LOCALSTATEDIR` +AC_SUBST(LOCALSTATEDIR) + +RUNSTATEDIR=`eval echo $runstatedir` +RUNSTATEDIR=`eval echo $RUNSTATEDIR` +AC_SUBST(RUNSTATEDIR) + +SYSCONFDIR=`eval echo $sysconfdir` +SYSCONFDIR=`eval echo $SYSCONFDIR` +AC_SUBST(SYSCONFDIR) + +AC_OUTPUT diff --git a/src/mech/src/Makefile.am b/src/mech/src/Makefile.am new file mode 100644 index 00000000..e2e661d5 --- /dev/null +++ b/src/mech/src/Makefile.am @@ -0,0 +1,7 @@ +include $(top_srcdir)/common.am + +CFLAGS = -Wall -Wextra -Werror -Wno-unused-parameter +SUBDIRS = core + +install-exec-hook: + find $(DESTDIR)$(clixonlibdir) -name '*.la' -delete diff --git a/src/mech/src/core/Makefile.am b/src/mech/src/core/Makefile.am new file mode 100644 index 00000000..034b7599 --- /dev/null +++ b/src/mech/src/core/Makefile.am @@ -0,0 +1,8 @@ +include $(top_srcdir)/common.am + +cli_LTLIBRARIES += cli.la +clispec_DATA += cli.cli + +cli_la_LDFLAGS = $(cli_ldflags) +cli_la_LIBADD = $(cli_libadd) +cli_la_SOURCES = cli.c diff --git a/src/mech/src/core/cli.c b/src/mech/src/core/cli.c new file mode 100644 index 00000000..0aff4d9f --- /dev/null +++ b/src/mech/src/core/cli.c @@ -0,0 +1,22 @@ +#include + +#include +#include +#include +#include + +int cli_sysinfo(clicon_handle h, cvec *cvv, cvec *argv) +{ + printf("System Information: Infix\n"); + return 0; +} + +static clixon_plugin_api cli_api = { + .ca_name = "infix-cli", + .ca_init = clixon_plugin_init, +}; + +clixon_plugin_api *clixon_plugin_init(clicon_handle h) +{ + return &cli_api; +} diff --git a/src/mech/src/core/cli.cli b/src/mech/src/core/cli.cli new file mode 100644 index 00000000..3aafb7ba --- /dev/null +++ b/src/mech/src/core/cli.cli @@ -0,0 +1,9 @@ +CLICON_MODE="exec"; +CLICON_PROMPT="%U@%H> "; +CLICON_PLUGIN="cli"; + +exit("Exit"), cli_quit(); + +show("Show various system state and configuration") { + system-information("System information"), cli_sysinfo(); +} diff --git a/src/mech/yang/Makefile.am b/src/mech/yang/Makefile.am new file mode 100644 index 00000000..ba5099c4 --- /dev/null +++ b/src/mech/yang/Makefile.am @@ -0,0 +1,3 @@ +include $(top_srcdir)/common.am + +yang_DATA += infix.yang diff --git a/src/mech/yang/infix.yang b/src/mech/yang/infix.yang new file mode 100644 index 00000000..31bc8a2c --- /dev/null +++ b/src/mech/yang/infix.yang @@ -0,0 +1,25 @@ +module infix { + yang-version 1.1; + namespace "urn:kernelkit:infix"; + prefix ix; +/* + import ietf-interfaces { + prefix if; + } + import ietf-ip { + prefix ip; + } + import iana-if-type { + prefix ianaift; + } + import ietf-datastores { + prefix ds; + } + import clixon-autocli{ + prefix autocli; + } +*/ + description + "Base model + "; +}