Jump to: navigation, search

Difference between revisions of "Satori/OpinionsProposal"

m (Add link to blueprint)
(Added plan for built in opinions examples per http://eavesdrop.openstack.org/meetings/satori/2014/satori.2014-02-24-15.00.html)
Line 8: Line 8:
 
* [https://blueprints.launchpad.net/satori/+spec/poc-certificate-detection SSL certificate of netloc]
 
* [https://blueprints.launchpad.net/satori/+spec/poc-certificate-detection SSL certificate of netloc]
 
* Neutron LBaaS that the netloc resolves to (not yet implemented in Satori)
 
* Neutron LBaaS that the netloc resolves to (not yet implemented in Satori)
 +
  
 
A user-provided Python module should be loaded at runtime that will allow the
 
A user-provided Python module should be loaded at runtime that will allow the
Line 83: Line 84:
 
== Proposed Implementation Plan ==
 
== Proposed Implementation Plan ==
  
# In a separate repo, create an opinions module template
+
# Write example built-in opinions.
# Alter `satori/discovery.py run()` to load the Python module provided on the command line.
+
## Create `satori/opinions/examples.py`
 +
## Opinion 1 - Nova: Warn if the hostname of a discovered nova instance is not a FQDN. 
 +
## Opinion 2: - DNS: Warn if their are fewer than two authoritative nameservers.
 +
# In a separate repo, create a 3rd party opinions module template
 +
# Alter `satori/discovery.py run()` to load the built-in example opinions if the `--opinions satori/opinions` command is provided. This should also work for the 3rd party opinions module with `--opinions mypython.module.name`.
 
# Call the provided module's opinions() function for every resource and append the data to the resource record.
 
# Call the provided module's opinions() function for every resource and append the data to the resource record.
 
# Update the shell code to output the opinions data.
 
# Update the shell code to output the opinions data.

Revision as of 17:20, 27 February 2014

Specification for Blueprint https://blueprints.launchpad.net/satori/+spec/poc-resource-opinions

As Satori gathers information about a network location it accumulates a list of resources that are related. Some examples of related resources:


A user-provided Python module should be loaded at runtime that will allow the user to add "opinions" to the resources based on their attributes.

There should not be any opinions built into Satori as opinions will most likely include business logic that are not universally accepted.

Proposed Opinion Data Structure

 opinions = {
 	'opinion_group1': {
 		'opinion1': {
			'title': 'My Title',
			'description': 'My description',
			'status': 'Warning'
		}
	}
 }
 

Example Use Case

Bob expects to renew SSL certificates within 30 days of their expiration and does not want his operations teams to deploy instances with flavor ID 4 into production. His Satori discovery on `https://domain.com` reveals that the SSL certificate is not going to expire soon but the Nova flavor is a violation of his best practices.

His opinions module would alter Satori's resource data and the resulting mashup would look like the following:

 resources = {
	'0': {
		'type': 'ssl-certificate',
		'domain': 'domain.com',
		'expires': datetime(2020, 1, 1),
		'opinions': {
			'certificate': {
				'expiration': {
					'title': 'SSL Renewal Check',
					'description': 'domain.com expires in 2000 days',
					'status': 'Ok'
				}
			}
		}
	'1',
		'type': 'nova-instance',
		'flavor': 4,
		'region': 'westcoast',
		'opinions': {
			'nova': {
				'flavor': {
					'title': 'Production Server Size',
					'description': 'Flavor ID 4 is too small for production use-cases'
					'status': 'Warning'
				}
			}
		}
	}
 }

List of Valid Statuses

Ok
Warning
Error

Command line usage

$ satori https://domain.com --opinions myopinions.production

Proposed Implementation Plan

  1. Write example built-in opinions.
    1. Create `satori/opinions/examples.py`
    2. Opinion 1 - Nova: Warn if the hostname of a discovered nova instance is not a FQDN.
    3. Opinion 2: - DNS: Warn if their are fewer than two authoritative nameservers.
  2. In a separate repo, create a 3rd party opinions module template
  3. Alter `satori/discovery.py run()` to load the built-in example opinions if the `--opinions satori/opinions` command is provided. This should also work for the 3rd party opinions module with `--opinions mypython.module.name`.
  4. Call the provided module's opinions() function for every resource and append the data to the resource record.
  5. Update the shell code to output the opinions data.