summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/installationprocedure/feature.configuration.rst9
-rw-r--r--docs/installationprocedure/featureconfig.rst (renamed from docs/configguide/featureconfig.rst)0
-rw-r--r--docs/installationprocedure/index.rst (renamed from docs/configguide/index.rst)9
-rw-r--r--docs/installationprocedure/installerconfig.rst (renamed from docs/configguide/installerconfig.rst)0
4 files changed, 13 insertions, 5 deletions
diff --git a/docs/installationprocedure/feature.configuration.rst b/docs/installationprocedure/feature.configuration.rst
new file mode 100644
index 0000000..86d7dfa
--- /dev/null
+++ b/docs/installationprocedure/feature.configuration.rst
@@ -0,0 +1,9 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+ .. (c) <optionally add copywriters name>
+
+
+Abstract
+========
+This document provides information on how to configure required
+components during the installation of the platform.
diff --git a/docs/configguide/featureconfig.rst b/docs/installationprocedure/featureconfig.rst
index dc4fc50..dc4fc50 100644
--- a/docs/configguide/featureconfig.rst
+++ b/docs/installationprocedure/featureconfig.rst
diff --git a/docs/configguide/index.rst b/docs/installationprocedure/index.rst
index 03ba4b0..13def7e 100644
--- a/docs/configguide/index.rst
+++ b/docs/installationprocedure/index.rst
@@ -3,13 +3,12 @@
.. http://creativecommons.org/licenses/by/4.0
.. (c) OPNFV, Ericsson AB and others.
-==========================
-Parser Configuration Guide
-==========================
+********************************************
+Parser Configuration and Configuration Guide
+********************************************
.. toctree::
:numbered:
:maxdepth: 2
-.. include:: featureconfig.rst
-.. include:: installerconfig.rst
+ feature.configuration.rst
diff --git a/docs/configguide/installerconfig.rst b/docs/installationprocedure/installerconfig.rst
index efe6265..efe6265 100644
--- a/docs/configguide/installerconfig.rst
+++ b/docs/installationprocedure/installerconfig.rst
(prefers-color-scheme: light) { .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
##############################################################################
# Copyright (c) 2015 Dell Inc  and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################



from keystoneclient.auth.identity import v2
from keystoneclient import session
from novaclient import client
import os
import re
from collections import defaultdict


class create_zones:

    def __init__(self):
        print 'Creating Zones'
        self._keystone_client = None
        self._nova_client = None

    def _get_keystone_client(self):
        '''returns a keystone client instance'''

        if self._keystone_client is None:
            '''
            self._keystone_client = keystoneclient.v2_0.client.Client(
            auth_url=os.environ.get('OS_AUTH_URL'),
            username=os.environ.get('OS_USERNAME'),
            password=os.environ.get('OS_PASSWORD'),
            tenant_name=os.environ.get('OS_TENANT_NAME'))
            '''
            auth = v2.Password(auth_url=os.environ.get('OS_AUTH_URL'),
                               username=os.environ.get('OS_USERNAME'),
                               password=os.environ.get('OS_PASSWORD'),
                               tenant_name=os.environ.get('OS_TENANT_NAME'))

            sess = session.Session(auth=auth)

        return sess

    def _get_nova_client(self):
        if self._nova_client is None:
            keystone = self._get_keystone_client()
            self._nova_client = client.Client('2', session=keystone)
        return self._nova_client

    def check_aggregate(self, nova, agg_name):
        list1 = nova.aggregates.list()

        agg_name_exist = False
        for x in list1:

            if x.name == agg_name:
                agg_name_exist = True
        return agg_name_exist

    def get_aggregate_id(self, nova, agg_name):
        list1 = nova.aggregates.list()
        agg_id = 0
        agg_name_exist = False
        for x in list1:
            if x.name == agg_name:
                agg_id = x.id
                return agg_id

    def check_host_added_to_aggregate(self, nova, agg_id, hostname):
        host_added = False
        list1 = nova.aggregates.get_details(agg_id)

        nme = str(list1.hosts)
        if(hostname in nme):
            host_added = True
        return host_added

    def del_agg(self, nova, id, host):

        nova.aggregates.remove_host(id, host)
        nova.aggregates.delete(id)

    def get_compute_num(self, computeName):

        num = re.findall(r'\d+',computeName)
        return (int(num[0])-1)

    def create_agg(self, D):
        nova = self._get_nova_client()
        hyper_list = nova.hypervisors.list()
        hostnA = []
        zone_machine = defaultdict(list)

        x = 0
        for x in range(len(hyper_list)):

            hostnA.append(hyper_list[x].service['host'])
            hostnA[x] = str(hostnA[x])

        hostnA.sort()
        for k in D:

            zone_machine[k].append(' ')

        for x in range(len(zone_machine)):
            compute_index = self.get_compute_num(D[x])
            if compute_index > len(hyper_list):
                print '\n The specified compute node doesnt exist. using compute 1'
                compute_index = 1
            if not self.check_aggregate(nova, hostnA[compute_index]):
                agg_idA = nova.aggregates.create(hostnA[compute_index], D[x])
                nova.aggregates.add_host(aggregate=agg_idA, host=hostnA[compute_index])

            else:

                id1 = self.get_aggregate_id(nova, hostnA[compute_index])
                self.del_agg(nova, id1, hostnA[compute_index])
                agg_idA = nova.aggregates.create(hostnA[compute_index], D[x])
                id1 = self.get_aggregate_id(nova, hostnA[compute_index])

                if not self.check_host_added_to_aggregate(
                        nova, id1, hostnA[compute_index]):

                    nova.aggregates.add_host(aggregate=id1, host=hostnA[compute_index])