Skip to content

Instantly share code, notes, and snippets.

View aojea's full-sized avatar

Antonio Ojea aojea

View GitHub Profile
@aojea
aojea / rally-neutron-mido.yaml
Created February 5, 2016 13:46
rally job default
{% set image_name = "^cirros.*$" %}
{% set smoke = 0 %}
---
NeutronNetworks.create_and_list_networks:
-
args:
network_create_args:
runner:
type: "constant"
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get -y install software-properties-common
add-apt-repository -y cloud-archive:mitaka
apt-get update && apt-get -y dist-upgrade
apt-get -y install keystone crudini python-openstackclient
crudini --set /etc/keystone/keystone.conf DEFAULT admin_token openstack
crudini --set /etc/keystone/keystone.conf token provider fernet
su -s /bin/sh -c "keystone-manage db_sync" keystone
keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone
@aojea
aojea / create_veth_pair.sh
Last active January 22, 2024 07:43
Create a veth pair
#!/usr/bin/env bash
while getopts ":n:m:i:g:" opt; do
case $opt in
n)
NAMESPACE=$OPTARG
;;
m)
MAC=$OPTARG
;;
@aojea
aojea / midonet_tzone.sh
Created August 12, 2016 08:05
Midonet automatic tunnel zone
#!/bin/bash
midonet-cli -e "list host" > /tmp/midonet-hosts.list
if midonet-cli -e list tunnel-zone 2>&1 | grep tz
then
TZONE0=$(midonet-cli -e list tunnel-zone | awk '{ print $2 }')
else
TZONE0=$(midonet-cli -e "tunnel-zone create name tz type vxlan")
fi
@aojea
aojea / Vagrantfile
Created December 28, 2016 20:15
Vagrantfile to test the install_rally.sh script
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
end
@aojea
aojea / k8s-csr-approve.sh
Created July 18, 2017 09:40
online kubernetes certificate auto approval
for i in $(kubectl get csr | grep Pending | awk '{ print $1 }' ) ; do kubectl certificate approve $i; done
@aojea
aojea / linked-clone.sh
Last active February 25, 2024 01:59
Script to create a linked clone with libvirt
#!/bin/bash
set -xe
# This script takes as a parameter the name of the VM
# and creates a linked clone
# Ref: https://unix.stackexchange.com/a/33584
# The scripts assumes that it runs from the same folder
# where the vm image is located and it coincides with the
# image name
@aojea
aojea / structures.py
Created October 7, 2017 16:22
Data structure for topN
class topN():
""" Implements an efficient data structure to return the top N elements
It increments the elements passed as parameter
"""
def __init__(self, N=10):
self.list = {}
self.N = N
self.topN = []
@aojea
aojea / junos_config.py
Created October 13, 2017 21:10
Configure JunOS device from text file
from jnpr.junos import Device
from jnpr.junos.utils.config import Config
import sys
import argparse
def main(argv):
parser = argparse.ArgumentParser()
parser.add_argument("h", help="host IP address")
parser.add_argument("f", help="configuration filename")
parser.add_argument("user", help="username")
@aojea
aojea / -
Created November 21, 2017 16:18
Zookeeper Server: zookeeper:2181
Connecting to Zookeeper Server... Connected.
Follow
Becoming leader
2017-11-21 16:12:16
Full thread dump OpenJDK 64-Bit Server VM (25.111-b14 mixed mode):
"BookKeeperClientWorker-3-0" #30 prio=5 os_prio=0 tid=0x000055a4f74a6800 nid=0x2a waiting on condition [0x00007f8c944a1000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)