3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
20 JUJU_AGENT_VERSION
=2.9.29
21 K8S_CLOUD_NAME
="k8s-cloud"
22 KUBECTL
="microk8s.kubectl"
24 OSMCLIENT_VERSION
=latest
25 IMAGES_OVERLAY_FILE
=~
/.osm
/images-overlay.yaml
26 PASSWORD_OVERLAY_FILE
=~
/.osm
/password-overlay.yaml
27 PATH
=/snap
/bin
:${PATH}
28 OSM_DEVOPS
="$( cd "$
( dirname "${BASH_SOURCE[0]}" )"/.. &> /dev/null && pwd )"
29 if [ -f ${OSM_DEVOPS}/common
/all_funcs
] ; then
30 source ${OSM_DEVOPS}/common
/all_funcs
35 function FATAL_TRACK
(){
43 OSM_HA_BUNDLE
=ch
:osm-ha
44 CHARMHUB_CHANNEL
=latest
/edge
47 function check_arguments
(){
48 while [ $# -gt 0 ] ; do
50 --bundle) BUNDLE
="$2" ;;
51 --overlay) OVERLAY
="$2" ;;
52 --k8s) KUBECFG
="$2" ;;
53 --vca) CONTROLLER
="$2" ;;
54 --small-profile) INSTALL_NOLXD
=y
;;
55 --lxd) LXD_CLOUD
="$2" ;;
56 --lxd-cred) LXD_CREDENTIALS
="$2" ;;
57 --microstack) MICROSTACK
=y
;;
58 --ha) BUNDLE
=$OSM_HA_BUNDLE ;;
60 --registry) REGISTRY_INFO
="$2" ;;
61 --only-vca) ONLY_VCA
=y
;;
66 # echo $BUNDLE $KUBECONFIG $LXDENDPOINT
69 function install_snaps
(){
70 if [ ! -v KUBECFG
]; then
72 sudo snap
install microk8s
--classic --channel=${MICROK8S_VERSION}/stable ||
73 FATAL_TRACK k8scluster
"snap install microk8s ${MICROK8S_VERSION}/stable failed"
74 sudo usermod
-a -G microk8s
`whoami`
75 sudo
cat /var
/snap
/microk8s
/current
/args
/kube-apiserver |
grep advertise-address ||
(
76 echo "--advertise-address $DEFAULT_IP" | sudo
tee -a /var
/snap
/microk8s
/current
/args
/kube-apiserver
77 sg
${KUBEGRP} -c microk8s.stop
78 sg
${KUBEGRP} -c microk8s.start
81 sudo chown
-f -R `whoami` ~
/.kube
82 sg
${KUBEGRP} -c "microk8s status --wait-ready"
83 KUBECONFIG
=~
/.osm
/microk8s-config.yaml
84 sg
${KUBEGRP} -c "microk8s config" |
tee ${KUBECONFIG}
85 track k8scluster k8scluster_ok
88 sudo snap
install kubectl
--classic
89 export KUBECONFIG
=${KUBECFG}
92 sudo snap
install juju
--classic --channel=$JUJU_VERSION/stable ||
93 FATAL_TRACK juju
"snap install juju ${JUJU_VERSION}/stable failed"
97 function bootstrap_k8s_lxd
(){
98 [ -v CONTROLLER
] && ADD_K8S_OPTS
="--controller ${CONTROLLER}" && CONTROLLER_NAME
=$CONTROLLER
99 [ ! -v CONTROLLER
] && ADD_K8S_OPTS
="--client" && BOOTSTRAP_NEEDED
="yes" && CONTROLLER_NAME
="osm-vca"
101 if [ -v BOOTSTRAP_NEEDED
]; then
102 CONTROLLER_PRESENT
=$
(juju controllers
2>/dev
/null|
grep ${CONTROLLER_NAME} |
wc -l)
103 if [ $CONTROLLER_PRESENT -ge 1 ]; then
105 Threre is already a VCA present with the installer reserved name of "${CONTROLLER_NAME}".
106 You may either explicitly use this VCA with the "--vca ${CONTROLLER_NAME}" option, or remove it
109 juju destroy-controller --release-storage --destroy-all-models -y ${CONTROLLER_NAME}
111 Please retry the installation once this conflict has been resolved.
113 FATAL_TRACK bootstrap_k8s
"VCA already present"
116 CONTROLLER_PRESENT
=$
(juju controllers
2>/dev
/null|
grep ${CONTROLLER_NAME} |
wc -l)
117 if [ $CONTROLLER_PRESENT -le 0 ]; then
119 Threre is no VCA present with the name "${CONTROLLER_NAME}". Please specify a VCA
120 that exists, or remove the --vca ${CONTROLLER_NAME} option.
122 Please retry the installation with one of the solutions applied.
124 FATAL_TRACK bootstrap_k8s
"Requested VCA not present"
128 if [ -v KUBECFG
]; then
129 cat $KUBECFG | juju add-k8s
$K8S_CLOUD_NAME $ADD_K8S_OPTS
130 [ -v BOOTSTRAP_NEEDED
] && juju bootstrap
$K8S_CLOUD_NAME $CONTROLLER_NAME \
131 --config controller-service-type
=loadbalancer \
132 --agent-version=$JUJU_AGENT_VERSION
134 sg
${KUBEGRP} -c "echo ${DEFAULT_IP}-${DEFAULT_IP} | microk8s.
enable metallb
"
135 sg ${KUBEGRP} -c "microk8s.
enable ingress
"
136 sg ${KUBEGRP} -c "microk8s.
enable storage dns
"
138 start_time="$
(date -u +%s
)"
142 if [[ $(( now - start_time )) -gt $TIME_TO_WAIT ]];then
143 echo "Microk8s storage failed to
enable"
144 sg ${KUBEGRP} -c "microk8s.status
"
145 FATAL_TRACK bootstrap_k8s "Microk8s storage failed to
enable"
147 storage_status=`sg ${KUBEGRP} -c "microk8s.status
-a storage
"`
148 if [[ $storage_status == "enabled
" ]]; then
154 [ ! -v BOOTSTRAP_NEEDED ] && sg ${KUBEGRP} -c "microk8s.config
" | juju add-k8s $K8S_CLOUD_NAME $ADD_K8S_OPTS
155 [ -v BOOTSTRAP_NEEDED ] && sg ${KUBEGRP} -c \
156 "juju bootstrap microk8s
$CONTROLLER_NAME --config controller-service-type
=loadbalancer
--agent-version=$JUJU_AGENT_VERSION" \
157 && K8S_CLOUD_NAME=microk8s
159 track bootstrap_k8s bootstrap_k8s_ok
161 if [ ! -v INSTALL_NOLXD ]; then
162 if [ -v LXD_CLOUD ]; then
163 if [ ! -v LXD_CREDENTIALS ]; then
164 echo "The installer needs the LXD server certificate
if the LXD is external
"
165 FATAL_TRACK bootstrap_lxd "No LXD certificate supplied
"
168 LXDENDPOINT=$DEFAULT_IP
169 LXD_CLOUD=~/.osm/lxd-cloud.yaml
170 LXD_CREDENTIALS=~/.osm/lxd-credentials.yaml
171 # Apply sysctl production values for optimal performance
172 sudo cp /usr/share/osm-devops/installers/60-lxd-production.conf /etc/sysctl.d/60-lxd-production.conf
175 sudo apt-get remove --purge -y liblxc1 lxc-common lxcfs lxd lxd-client
176 sudo snap install lxd --channel $LXD_VERSION/stable
178 sudo usermod -a -G lxd `whoami`
179 cat /usr/share/osm-devops/installers/lxd-preseed.conf | sed 's/^config: {}/config:\n core.https_address: '$LXDENDPOINT':8443/' | sg lxd -c "lxd init
--preseed"
180 sg lxd -c "lxd waitready
"
181 DEFAULT_MTU=$(ip addr show $DEFAULT_IF | perl -ne 'if (/mtu\s(\d+)/) {print $1;}')
182 sg lxd -c "lxc profile device
set default eth0 mtu
$DEFAULT_MTU"
183 sg lxd -c "lxc network
set lxdbr0 bridge.mtu
$DEFAULT_MTU"
185 cat << EOF > $LXD_CLOUD
189 auth-types: [certificate]
190 endpoint: "https
://$LXDENDPOINT:8443"
192 ssl-hostname-verification: false
194 openssl req -nodes -new -x509 -keyout ~/.osm/client.key -out ~/.osm/client.crt -days 365 -subj "/C
=FR
/ST
=Nice
/L
=Nice
/O
=ETSI
/OU
=OSM
/CN
=osm.etsi.org
"
195 local server_cert=`cat /var/snap/lxd/common/lxd/server.crt | sed 's/^/ /'`
196 local client_cert=`cat ~/.osm/client.crt | sed 's/^/ /'`
197 local client_key=`cat ~/.osm/client.key | sed 's/^/ /'`
199 cat << EOF > $LXD_CREDENTIALS
203 auth-type: certificate
211 lxc config trust add local: ~/.osm/client.crt
214 juju add-cloud -c $CONTROLLER_NAME lxd-cloud $LXD_CLOUD --force
215 juju add-credential -c $CONTROLLER_NAME lxd-cloud -f $LXD_CREDENTIALS
216 sg lxd -c "lxd waitready
"
217 juju controller-config features=[k8s-operators]
218 track bootstrap_lxd bootstrap_lxd_ok
222 function deploy_charmed_osm(){
223 if [ -v REGISTRY_INFO ] ; then
224 registry_parts=(${REGISTRY_INFO//@/ })
225 if [ ${#registry_parts[@]} -eq 1 ] ; then
226 # No credentials supplied
229 REGISTRY_URL=${registry_parts[0]}
231 credentials=${registry_parts[0]}
232 credential_parts=(${credentials//:/ })
233 REGISTRY_USERNAME=${credential_parts[0]}
234 REGISTRY_PASSWORD=${credential_parts[1]}
235 REGISTRY_URL=${registry_parts[1]}
237 # Ensure the URL ends with a /
238 case $REGISTRY_URL in
240 *) REGISTRY_URL=${REGISTRY_URL}/
244 echo "Creating OSM model
"
245 if [ -v KUBECFG ]; then
246 juju add-model $MODEL_NAME $K8S_CLOUD_NAME
248 sg ${KUBEGRP} -c "juju add-model
$MODEL_NAME $K8S_CLOUD_NAME"
250 echo "Deploying OSM with charms
"
252 if [ -v REGISTRY_URL ]; then
253 [ ! -v TAG ] && TAG='latest'
255 [ -v TAG ] && generate_images_overlay && images_overlay="--overlay $IMAGES_OVERLAY_FILE"
257 if [ -v OVERLAY ]; then
258 extra_overlay="--overlay $OVERLAY"
260 echo "Creating Password Overlay
"
262 generate_password_overlay && secret_overlay="--overlay $PASSWORD_OVERLAY_FILE"
264 if [ -v BUNDLE ]; then
265 juju deploy --trust --channel $CHARMHUB_CHANNEL -m $MODEL_NAME $BUNDLE --overlay ~/.osm/vca-overlay.yaml $images_overlay $extra_overlay $secret_overlay
267 juju deploy --trust --channel $CHARMHUB_CHANNEL -m $MODEL_NAME $OSM_BUNDLE --overlay ~/.osm/vca-overlay.yaml $images_overlay $extra_overlay $secret_overlay
270 if [ ! -v KUBECFG ]; then
271 API_SERVER=${DEFAULT_IP}
273 API_SERVER=$(kubectl config view --minify | grep server | cut -f 2- -d ":" | tr -d " ")
274 proto="$
(echo $API_SERVER |
grep :// |
sed -e's,^\(.*://\).*,\1,g')"
275 url="$
(echo ${API_SERVER/$proto/})"
276 user="$
(echo $url |
grep @ | cut
-d@
-f1)"
277 hostport="$
(echo ${url/$user@/} | cut
-d/ -f1)"
278 API_SERVER="$
(echo $hostport |
sed -e 's,:.*,,g')"
280 # Expose OSM services
281 juju config -m $MODEL_NAME nbi site_url=https://nbi.${API_SERVER}.nip.io
282 juju config -m $MODEL_NAME ng-ui site_url=https://ui.${API_SERVER}.nip.io
283 juju config -m $MODEL_NAME grafana site_url=https://grafana.${API_SERVER}.nip.io
284 juju config -m $MODEL_NAME prometheus site_url=https://prometheus.${API_SERVER}.nip.io
286 echo "Waiting
for deployment to finish...
"
288 grafana_leader=`juju status -m $MODEL_NAME grafana | grep "*" | cut -d "*" -f 1`
289 grafana_admin_password=`juju run -m $MODEL_NAME --unit $grafana_leader "echo \\$GF_SECURITY_ADMIN_PASSWORD"`
290 juju config -m $MODEL_NAME mon grafana_password=$grafana_admin_password
292 echo "OSM with charms deployed
"
295 function check_osm_deployed() {
297 start_time="$
(date -u +%s
)"
298 total_service_count=14
302 service_count=$(juju status --format json -m $MODEL_NAME | jq '.applications[]."application-status
".current' | grep active | wc -l)
303 echo "$service_count / $total_service_count services active
"
304 if [ $service_count -eq $total_service_count ]; then
307 if [ $service_count -ne $previous_count ]; then
308 previous_count=$service_count
309 start_time="$
(date -u +%s
)"
312 if [[ $(( now - start_time )) -gt $TIME_TO_WAIT ]];then
313 echo "Timed out waiting
for OSM services to become ready
"
314 FATAL_TRACK deploy_osm "Timed out waiting
for services to become ready
"
320 function generate_password_overlay() {
322 web_config_password=`openssl rand -hex 16`
324 keystone_db_password=`openssl rand -hex 16`
325 keystone_admin_password=`openssl rand -hex 16`
326 keystone_service_password=`openssl rand -hex 16`
328 mariadb_password=`openssl rand -hex 16`
329 mariadb_root_password=`openssl rand -hex 16`
330 cat << EOF > /tmp/password-overlay.yaml
334 web_config_password: $web_config_password
337 keystone-db-password: $keystone_db_password
338 admin-password: $keystone_admin_password
339 service-password: $keystone_service_password
342 password: $mariadb_password
343 root_password: $mariadb_root_password
345 mv /tmp/password-overlay.yaml $PASSWORD_OVERLAY_FILE
348 function create_overlay() {
351 local HOME=/home/$USER
352 local vca_user=$(cat $HOME/.local/share/juju/accounts.yaml | yq e .controllers.$CONTROLLER_NAME.user - )
353 local vca_secret=$(cat $HOME/.local/share/juju/accounts.yaml | yq e .controllers.$CONTROLLER_NAME.password - )
354 local vca_host=$(cat $HOME/.local/share/juju/controllers.yaml | yq e .controllers.$CONTROLLER_NAME.api-endpoints[0] - | cut -d ":" -f 1)
355 local vca_port=$(cat $HOME/.local/share/juju/controllers.yaml | yq e .controllers.$CONTROLLER_NAME.api-endpoints[0] - | cut -d ":" -f 2)
356 local vca_pubkey=\"$(cat $HOME/.local/share/juju/ssh/juju_id_rsa.pub)\"
357 local vca_cloud="lxd-cloud
"
358 # Get the VCA Certificate
359 local vca_cacert=$(cat $HOME/.local/share/juju/controllers.yaml | yq e .controllers.$CONTROLLER_NAME.ca-cert - | base64 | tr -d \\n)
361 # Calculate the default route of this machine
362 local DEFAULT_IF=`ip route list match 0.0.0.0 | awk '{print $5}'`
364 # Generate a new overlay.yaml, overriding any existing one
365 cat << EOF > /tmp/vca-overlay.yaml
370 vca_secret: $vca_secret
373 vca_pubkey: $vca_pubkey
374 vca_cacert: $vca_cacert
375 vca_cloud: $vca_cloud
376 vca_k8s_cloud: $K8S_CLOUD_NAME
380 vca_secret: $vca_secret
382 vca_cacert: $vca_cacert
384 mv /tmp/vca-overlay.yaml ~/.osm/
385 OSM_VCA_HOST=$vca_host
388 function generate_images_overlay(){
389 echo "applications
:" > /tmp/images-overlay.yaml
391 charms_with_resources="nbi lcm mon pol ng-ui ro pla
"
392 for charm in $charms_with_resources; do
393 cat << EOF > /tmp/${charm}_registry.yaml
394 registrypath: ${REGISTRY_URL}opensourcemano/${charm}:$TAG
396 if [ ! -z "$REGISTRY_USERNAME" ] ; then
397 echo username: $REGISTRY_USERNAME >> /tmp/${charm}_registry.yaml
398 echo password: $REGISTRY_PASSWORD >> /tmp/${charm}_registry.yaml
401 cat << EOF >> /tmp/images-overlay.yaml
404 image: /tmp/${charm}_registry.yaml
408 ch_charms_with_resources="keystone
"
409 for charm in $ch_charms_with_resources; do
410 cat << EOF > /tmp/${charm}_registry.yaml
411 registrypath: ${REGISTRY_URL}opensourcemano/${charm}:$TAG
413 if [ ! -z "$REGISTRY_USERNAME" ] ; then
414 echo username: $REGISTRY_USERNAME >> /tmp/${charm}_registry.yaml
415 echo password: $REGISTRY_PASSWORD >> /tmp/${charm}_registry.yaml
418 cat << EOF >> /tmp/images-overlay.yaml
421 ${charm}-image: /tmp/${charm}_registry.yaml
426 mv /tmp/images-overlay.yaml $IMAGES_OVERLAY_FILE
429 function refresh_osmclient_snap() {
430 osmclient_snap_install_refresh refresh
433 function install_osm_client_snap() {
434 osmclient_snap_install_refresh install
437 function osmclient_snap_install_refresh() {
438 channel_preference="stable candidate beta edge
"
439 for channel in $channel_preference; do
440 echo "Trying to
install osmclient from channel
$OSMCLIENT_VERSION/$channel"
441 sudo snap $1 osmclient --channel $OSMCLIENT_VERSION/$channel 2> /dev/null && echo osmclient snap installed && break
444 function install_osmclient() {
445 snap info osmclient | grep -E ^installed: && refresh_osmclient_snap || install_osm_client_snap
448 function add_local_k8scluster() {
449 osm --all-projects vim-create \
450 --name _system-osm-vim \
451 --account_type dummy \
452 --auth_url http://dummy \
453 --user osm --password osm --tenant osm \
454 --description "dummy
" \
455 --config '{management_network_name: mgmt}'
456 tmpfile=$(mktemp --tmpdir=${HOME})
457 cp ${KUBECONFIG} ${tmpfile}
458 osm --all-projects k8scluster-add \
460 --vim _system-osm-vim \
461 --k8s-nets '{"net1
": null}' \
463 --description "OSM Internal Cluster
" \
468 function install_microstack() {
469 sudo snap install microstack --beta --devmode
471 CHECK=$(microstack.openstack server list)
472 if [ $? -ne 0 ] ; then
473 if [[ $CHECK == *"not initialized
"* ]]; then
474 echo "Setting MicroStack dashboard to listen to port
8080"
475 sudo snap set microstack config.network.ports.dashboard=8080
476 echo "Initializing MicroStack. This can take several minutes
"
477 sudo microstack.init --auto --control
481 sudo snap alias microstack.openstack openstack
483 echo "Updating default security group
in MicroStack to allow all access
"
485 for i in $(microstack.openstack security group list | awk '/default/{ print $2 }'); do
486 for PROTO in icmp tcp udp ; do
487 echo " $PROTO ingress
"
488 CHECK=$(microstack.openstack security group rule create $i --protocol $PROTO --remote-ip 0.0.0.0/0 2>&1)
489 if [ $? -ne 0 ] ; then
490 if [[ $CHECK != *"409"* ]]; then
491 echo "Error creating ingress rule
for $PROTO"
498 microstack.openstack network show osm-ext &>/dev/null
499 if [ $? -ne 0 ]; then
500 echo "Creating osm-ext network with router to bridge to MicroStack external network
"
501 microstack.openstack network create --enable --no-share osm-ext
502 microstack.openstack subnet create osm-ext-subnet --network osm-ext --dns-nameserver 8.8.8.8 \
503 --subnet-range 172.30.0.0/24
504 microstack.openstack router create external-router
505 microstack.openstack router add subnet external-router osm-ext-subnet
506 microstack.openstack router set --external-gateway external external-router
509 microstack.openstack image list | grep ubuntu20.04 &> /dev/null
510 if [ $? -ne 0 ] ; then
511 echo "Fetching Ubuntu
20.04 image and upLoading to MicroStack
"
512 wget -q -O- https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img \
513 | microstack.openstack image create --public --container-format=bare \
514 --disk-format=qcow2 ubuntu20.04 | grep status
517 if [ ! -f ~/.ssh/microstack ]; then
518 ssh-keygen -t rsa -N "" -f ~/.ssh/microstack
519 microstack.openstack keypair create --public-key ~/.ssh/microstack.pub microstack
522 echo "Creating VIM microstack-site
in OSM
"
523 . /var/snap/microstack/common/etc/microstack.rc
526 --name microstack-site \
527 --user "$OS_USERNAME" \
528 --password "$OS_PASSWORD" \
529 --auth_url "$OS_AUTH_URL" \
530 --tenant "$OS_USERNAME" \
531 --account_type openstack \
532 --config='{use_floating_ip: True,
535 management_network_name: osm-ext}'
538 DEFAULT_IF=`ip route list match 0.0.0.0 | awk '{print $5; exit}'`
539 DEFAULT_IP=`ip -o -4 a |grep ${DEFAULT_IF}|awk '{split($4,a,"/"); print a[1]; exit}'`
546 if [ -v ONLY_VCA ]; then
548 vca_user=$(cat $HOME/.local/share/juju/accounts.yaml | yq e .controllers.$CONTROLLER_NAME.user - )
549 vca_secret=$(cat $HOME/.local/share/juju/accounts.yaml | yq e .controllers.$CONTROLLER_NAME.password - )
550 vca_host=$(cat $HOME/.local/share/juju/controllers.yaml | yq e .controllers.$CONTROLLER_NAME.api-endpoints[0] - | cut -d ":" -f 1)
551 vca_port=$(cat $HOME/.local/share/juju/controllers.yaml | yq e .controllers.$CONTROLLER_NAME.api-endpoints[0] - | cut -d ":" -f 2)
552 vca_pubkey=\"$(cat $HOME/.local/share/juju/ssh/juju_id_rsa.pub)\"
553 vca_cloud="lxd-cloud
"
554 vca_cacert=$(cat $HOME/.local/share/juju/controllers.yaml | yq e .controllers.$CONTROLLER_NAME.ca-cert - | base64 | tr -d \\n)
555 hostname=`cat /etc/hostname`
557 echo "Use the following
command to register the installed VCA to your OSM
:"
558 echo -e " osm vca-add
--endpoints $vca_host:$vca_port \\\n --user $vca_user \\\n --secret $vca_secret \\\n --cacert $vca_cacert \\\n --lxd-cloud lxd-cloud
\\\n --lxd-credentials lxd-cloud
\\\n --k8s-cloud microk8s
\\\n --k8s-credentials microk8s
\\\n $hostname-vca"
559 track deploy_osm deploy_vca_only_ok
562 track deploy_osm deploy_osm_services_k8s_ok
564 track osmclient osmclient_ok
565 export OSM_HOSTNAME=$(juju config -m $MODEL_NAME nbi site_url | sed "s
/http.
*\?:\
/\
///"):443
566 export OSM_PASSWORD=$keystone_admin_password
569 track final_ops add_local_k8scluster_ok
570 if [ -v MICROSTACK ]; then
572 track final_ops install_microstack_ok
575 echo "Your installation is now complete
, follow these steps
for configuring the osmclient
:"
577 echo "1. Create the OSM_HOSTNAME environment variable with the NBI IP
"
579 echo "export OSM_HOSTNAME
=$OSM_HOSTNAME"
580 echo "export OSM_PASSWORD
=$OSM_PASSWORD"
582 echo "2. Add the previous commands to your .bashrc
for other Shell sessions
"
584 echo "echo \"export OSM_HOSTNAME
=$OSM_HOSTNAME\" >> ~
/.bashrc
"
585 echo "echo \"export OSM_PASSWORD
=$OSM_PASSWORD\" >> ~
/.bashrc
"
587 echo "3. Login OSM GUI by using admin password
: $OSM_PASSWORD"