<commit_before>mininet-test
============

Setup the Environment
---------------------

1. Get the mininet image:

        mkdir in
        pushd in
        wget https://bitbucket.org/mininet/mininet-vm-images/downloads/mininet-2.1.0-130919-ubuntu-13.04-server-amd64-ovf.zip
        popd

2. Convert the image to a qcow2:

        pushd in
        unzip mininet-2.1.0-130919-ubuntu-13.04-server-amd64-ovf.zip
        popd
        mkdir -p ~/vm/pool/baseline
        virt-convert -D qcow2 in ~/vm/pool/baseline
        chmod 444 ~/vm/pool/baseline/


3. Create an external snapshot:

        mkdir -p ~/vm/pool/snapshots
        pushd ~/vm/pool/snapshots
        qemu-img create -f qcow2 -b ../baseline/mininet-vm-x86_64.qcow2 mininet.qcow2
        popd

4. Define the domain:

        PATH_TO_SS="$HOME/vm/pool/snapshots/mininet.qcow2"
        cat res/mininet-domain.xml | grep 'source file' # view placeholder path
        sed -i -e "s^/path/to/mininet.qcow2^$PATH_TO_SS^" res/mininet-domain.xml
        cat res/mininet-domain.xml | grep 'source file' # verify path is correct
        virsh define res/mininet-domain.xml

5. Configure mininet:

        virsh start mininet
        ip addr show # Review host network settings
        vncviewer :1 # the first boot will take a little time
        ############# Guest Commands #############
        # Login to the guest (login: mininet password: <PASSWORD>)
        sudo -i # become root
        NET=/etc/network/interfaces
        IP=192.168.10.3 # Set to available ip on your host network
        NETMASK=255.255.255.0 # Set to your networks netmask
        GATEWAY=192.168.10.1 # Set to your networks gateway
        NS=192.168.10.1 # Set to your local recursive nameserver
        echo auto lo > $NET
        echo iface lo inet loopback >> $NET
        echo auto eth0 >> $NET
        echo iface eth0 inet static >> $NET
        echo "    address $IP" >> $NET
        echo "    netmask $NETMASK" >> $NET
        echo "    gateway $GATEWAY" >> $NET
        echo "    dns-nameservers $NS" >> $NET
        cat $NET # Verify file looks correct
        service networking restart
        ssh-keygen -lf /etc/ssh/ssh_host_ecdsa_key.pub
        exit
        exit
        # Close window
        ############# Host  Commands #############
        # Setup networking over wireless "bridge" for guest
        su -c 'src/vm-bridge mininet 192.168.10.3' # Set to guests IP
        su -c 'echo "192.168.10.3   mininet" >> /etc/hosts'
        ssh mininet@mininet # fingerprint should match above if ECDSA
        mkdir ~/.ssh/
        # Couple optional config items:
        #echo 'set editing-mode vi' > ~/.inputrc
        #echo 'set -o vi'|cat - ~/.bashrc > /tmp/out && mv /tmp/out ~/.bashrc
        exit
        scp /home/jesse/.ssh/id_rsa.pub mininet@mininet:~/.ssh/authorized_keys
        ssh mininet@mininet
        sudo apt-get install acpid acpi-support # virsh shutdown support
        sudo apt-get install bwm-ng python-matplotlib python-argparse\
        vnc4server libnss3-dev # stuff you will likely need
        exit
        virsh shutdown mininet && watch -n 1 'virsh list --all'
        # ctrl+c after state goes to shut off

6. Create an internal snapshot:

        virsh snapshot-create-as mininet base-config "Mostly networking config"

7. Configure pyretic:

        virsh start mininet
        ssh mininet@mininet
        # Follow pyretic instructions (skip any Virtual Box / VM export steps):
        #  https://github.com/frenetic-lang/pyretic/wiki/Building-the-Pyretic-VM
        exit
        virsh shutdown mininet && watch -n 1 'virsh list --all'
        # ctrl+c after state goes to shut off

8. Create an internal snapshot:

        virsh snapshot-create-as mininet pyretic "Pyretic config"

9. Verify everything works
10. Cleanup downloaded and intermediate files
        rm -iv mininet-2.1.0-130919-ubuntu-13.04-server-amd64-ovf.zip
        rm -riv in

Prototype for testing mininet solutions

For program contract please run:

     server.py -h<commit_msg>fixes to README<commit_after>mininet-test
============

Setup the Environment
---------------------

1. Get the mininet image:

        mkdir in
        pushd in
        wget https://bitbucket.org/mininet/mininet-vm-images/downloads/mininet-2.1.0-130919-ubuntu-13.04-server-amd64-ovf.zip
        popd

2. Convert the image to a qcow2:

        pushd in
        unzip mininet-2.1.0-130919-ubuntu-13.04-server-amd64-ovf.zip
        popd
        mkdir -p ~/vm/pool/baseline
        virt-convert -D qcow2 in ~/vm/pool/baseline
        chmod 444 ~/vm/pool/baseline/


3. Create an external snapshot:

        mkdir -p ~/vm/pool/snapshots
        pushd ~/vm/pool/snapshots
        qemu-img create -f qcow2 -b ../baseline/mininet-vm-x86_64.qcow2 mininet.qcow2
        popd

4. Define the domain:

        PATH_TO_SS="$HOME/vm/pool/snapshots/mininet.qcow2"
        cat res/mininet-domain.xml | grep 'source file' # view placeholder path
        sed -i -e "s^/path/to/mininet.qcow2^$PATH_TO_SS^" res/mininet-domain.xml
        cat res/mininet-domain.xml | grep 'source file' # verify path is correct
        virsh define res/mininet-domain.xml

5. Configure mininet:

        virsh start mininet
        ip addr show # Review host network settings
        vncviewer :1 # the first boot will take a little time
        ############# Guest Commands #############
        # Login to the guest (login: mininet password: <PASSWORD>)
        sudo -i # become root
        NET=/etc/network/interfaces
        IP=192.168.10.3 # Set to available ip on your host network
        NETMASK=255.255.255.0 # Set to your networks netmask
        GATEWAY=192.168.10.1 # Set to your networks gateway
        NS=192.168.10.1 # Set to your local recursive nameserver
        echo auto lo > $NET
        echo iface lo inet loopback >> $NET
        echo auto eth0 >> $NET
        echo iface eth0 inet static >> $NET
        echo "    address $IP" >> $NET
        echo "    netmask $NETMASK" >> $NET
        echo "    gateway $GATEWAY" >> $NET
        echo "    dns-nameservers $NS" >> $NET
        cat $NET # Verify file looks correct
        service networking restart
        ssh-keygen -lf /etc/ssh/ssh_host_ecdsa_key.pub
        exit
        exit
        # Close window
        ############# Host  Commands #############
        # Setup networking over wireless "bridge" for guest
        su -c 'src/vm-bridge mininet 192.168.10.3' # Set to guests IP
        su -c 'echo "192.168.10.3   mininet" >> /etc/hosts'
        ssh mininet@mininet # fingerprint should match above if ECDSA
        mkdir ~/.ssh/
        # Couple optional config items:
        #echo 'set editing-mode vi' > ~/.inputrc
        #echo 'set -o vi'|cat - ~/.bashrc > /tmp/out && mv /tmp/out ~/.bashrc
        exit
        scp /home/jesse/.ssh/id_rsa.pub mininet@mininet:~/.ssh/authorized_keys
        ssh mininet@mininet
        sudo apt-get install acpid acpi-support # virsh shutdown support
        sudo apt-get install arping bwm-ng python-matplotlib python-argparse\
        vnc4server libnss3-dev # stuff you will likely need
        exit
        virsh shutdown mininet && watch -n 1 'virsh list --all'
        # ctrl+c after state goes to shut off

6. Create an internal snapshot:

        virsh snapshot-create-as mininet base-config "Mostly networking config"

7. Configure pyretic:

        virsh start mininet
        ssh mininet@mininet
        # Follow pyretic instructions (skip any Virtual Box / VM export steps):
        #  https://github.com/frenetic-lang/pyretic/wiki/Building-the-Pyretic-VM
        #  N.B., make sure your path changes are persistent
        exit
        virsh shutdown mininet && watch -n 1 'virsh list --all'
        # ctrl+c after state goes to shut off

8. Create an internal snapshot:

        virsh snapshot-create-as mininet pyretic "Pyretic config"

9. Verify everything works
10. Cleanup downloaded and intermediate files
        rm -iv mininet-2.1.0-130919-ubuntu-13.04-server-amd64-ovf.zip
        rm -riv in

Prototype for testing mininet solutions

For program contract please run:

     server.py -h
{'fraction_non_alphanumeric': 0.10920744484161223, 'fraction_numerical': 0.03254036731172193, 'mean_word_length': 2.1231716705157813, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 43, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 12, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4750521', 'n_tokens_mistral': 2738, 'n_tokens_neox': 2521, 'n_words': 786}