relpipe-data/examples/netplan-1.sh
author František Kučera <franta-hg@frantovo.cz>
Mon, 21 Feb 2022 00:43:11 +0100
branchv_0
changeset 329 5bc2bb8b7946
permissions -rwxr-xr-x
Release v0.18

#!/bin/bash

cat netplan.yaml \
	| relpipe-in-yamltable \
		--relation 'nic' \
			--records '/yaml/network/ethernets/*|/yaml/network/bridges/*' \
			--attribute 'name'         string    'name()' \
			--attribute 'type'         string    'name(..)' \
			--attribute 'dhcp4'        boolean   'dhcp4' \
			--attribute 'dhcp6'        boolean   'dhcp6' \
			--attribute 'accept-ra'    boolean   'accept-ra' \
		--relation 'bridge' \
			--records '/yaml/network/bridges/*' \
			--attribute 'name'         string    'name()' \
			--attribute 'gateway4'     string    'gateway4' \
			--attribute 'mtu'          string    'mtu' \
		--relation 'bridge_interface' \
			--records '/yaml/network/bridges/*/interfaces' \
			--attribute 'bridge'       string    'name(..)' \
			--attribute 'interface'    string    '.' \
		--relation 'ip' \
			--records '/yaml/network/bridges/*/addresses' \
			--attribute 'address'      string    'substring-before(., "/")' \
			--attribute 'mask'         string    'substring-after(., "/")' \
			--attribute 'interface'    string    'name(..)' \
	| relpipe-out-tabular

# an early draft of the relational mapping