#!/bin/sh 
# Copyright 07/07/97 Sun Microsystems, Inc. All Rights Reserved.
# "@(#) update_topoimex_export_file  1.0 07/07/97 Sun Microsystems"
#
# This script converts topology information exported from a EM 2.0 Patch 3
# or prior system (with the SUNWembc [SNM Backward Compatibility] package
# installed into a format which can be re-imported into an EM 2.0 Patch 4
# system.
#

if [ -z "$1" ]
then
echo "" 
echo "Usage: em_topoimex_BC <filename>"
echo ""
echo "where <filename> is the name, including the path, of the file "
echo "to be converted."
echo ""
echo "This script converts topology information exported from an"
echo "EM 2.0 Patch 3 or prior system (with the SUNWembc [SNM Backward"
echo "Compatibility] package installed) into a format which can be"
echo "re-imported without error into an EM 2.0 Patch 4 system."
echo "This bug will be addressed in em_topoimex in EM 2.0 Patch 5."
echo "em_topoimex -export is not affected"
echo ""
exit 1
fi

echo "" 
echo "Updating exported Patch 3 or prior em_topoimex export file"
echo ""
echo "Phase 1 - GDMO MODULE Names for SNM elements.schema"
#
#
/usr/xpg4/bin/ex -s $1 <<IMPORTFILE
g/RPC Elements - elementsschema/s!RPC Elements - elementsschema!RPC Elements - elements-schema!g
g/snm-/s!snm-!typSIGN!g
w
q
IMPORTFILE
echo "          Complete"
echo ""
echo "Phase 2 - SNM Schema View Type Names"
#
#
/usr/xpg4/bin/ex -s $1 <<IMPORTFILE2
g/viewdotnetworkData/s!viewdotnetworkData!viewdotnetwork!g
g/viewdotbuildingData/s!viewdotbuildingData!viewdotbuilding!g
g/viewdotcampusData/s!viewdotcampusData!viewdotcampus!g
g/viewdotbusData/s!viewdotbusData!viewdotbus!g
g/viewdotsubnetData/s!viewdotsubnetData!viewdotsubnet!g
g/viewdotringData/s!viewdotringData!viewdotring!g
g/viewdotstarData/s!viewdotstarData!viewdotstar!g 
w
q
IMPORTFILE2
echo "          Complete"
echo ""
echo "Phase 3 - SNM Schema Connection Type Names"
#
#
/usr/xpg4/bin/ex -s $1 <<IMPORTFILE3
g/connectiondotlinkData/s!connectiondotlinkData!connectiondotlink!g
g/connectiondotrs232Data/s!connectiondotrs232Data!connectiondotrs232!g
w
q
IMPORTFILE3
echo "          Complete"
echo ""
echo "Phase 4 - SNM Schema Bus Type Names"
#
#
/usr/xpg4/bin/ex -s $1 <<IMPORTFILE4
g/busdotethernetData/s!busdotethernetData!busdotethernet!g
w
q
IMPORTFILE4
echo "          Complete"
echo ""
echo "Phase 5 - SNM Schema Component Type Names"
#
#
/usr/xpg4/bin/ex -s $1 <<IMPORTFILE5
g/componentdottermsrvrData/s!componentdottermsrvrData!componentdottermsrvr!g
g/componentdotlaptopData/s!componentdotlaptopData!componentdotlaptop!g
g/componentdotgenhostData/s!componentdotgenhostData!componentdotgenhost!g
g/componentdotworkstationData/s!componentdotworkstationData!componentdotworkstation!g
g/componentdotss1Data/s!componentdotss1Data!componentdotss1!g
g/componentdotpcData/s!componentdotpcData!componentdotpc!g
g/componentdotrouterData/s!componentdotrouterData!componentdotrouter!g
g/componentdotbridgeData/s!componentdotbridgeData!componentdotbridge!g
g/componentdotserverData/s!componentdotserverData!componentdotserver!g
g/componentdothubData/s!componentdothubData!componentdothub!g
g/componentdotgenwsData/s!componentdotgenwsData!componentdotgenws!g
g/componentdotprinterData/s!componentdotprinterData!componentdotprinter!g
g/componentdotnewsprinterData/s!componentdotnewsprinterData!componentdotnewsprinter!g
g/componentdotlaserwriterData/s!componentdotlaserwriterData!componentdotlaserwriter!g
g/componentdotlanboxData/s!componentdotlanboxData!componentdotlanbox!g
g/componentdotss5Data/s!componentdotss5Data!componentdotss5!g
g/componentdotss20Data/s!componentdotss20Data!componentdotss20!g
g/componentdotsun470Data/s!componentdotsun470Data!componentdotsun470!g
g/componentdotsun4Data/s!componentdotsun4Data!componentdotsun4!g
g/componentdotsun386Data/s!componentdotsun386Data!componentdotsun386!g
g/componentdotsun3Data/s!componentdotsun3Data!componentdotsun3!g
g/componentdotss370Data/s!componentdotss370Data!componentdotss370!g
g/componentdotss330Data/s!componentdotss330Data!componentdotss330!g
g/componentdotsc2000Data/s!componentdotsc2000Data!componentdotsc2000!g
g/componentdotsc1000Data/s!componentdotsc1000Data!componentdotsc1000!g
g/componentdotss10Data/s!componentdotss10Data!componentdotss10!g
g/componentdotlxData/s!componentdotlxData!componentdotlx!g
g/componentdotipxData/s!componentdotipxData!componentdotipx!g
g/componentdotipcData/s!componentdotipcData!componentdotipc!g
g/componentdotss2Data/s!componentdotss2Data!componentdotss2!g
g/componentdotsunhynserverData/s!componentdotsunhynserverData!componentdotsun-server!g
g/componentdotsunhyndesksideData/s!componentdotsunhyndesksideData!componentdotsun-deskside!g
g/componentdotsunhynworkstationData/s!componentdotsunhynworkstationData!componentdotsun-workstation!g
g/componentdotxhynterminalData/s!componentdotxhynterminalData!componentdotx-terminal!g
w
q
IMPORTFILE5
#
#
echo "          Complete"
echo ""
echo "Phase 6 - SNM Schema Symbols"
/usr/xpg4/bin/ex -s $1 <<IMPORTFILE6
g/viewdot/s!viewdot!viewdotSIGN!g
g/componentdot/s!componentdot!componentdotSIGN!g
g/busdot/s!busdot!busdotSIGN!g
g/connectiondot/s!connectiondot!connectiondotSIGN!g
w
q
IMPORTFILE6
echo "          Complete"
echo ""
echo "Phase 7 - SNM Schema Attribute Names"
/usr/xpg4/bin/ex -s $1 <<IMPORTFILE7
g/glyphusrState/s!glyphusrState!gupcSIGNlyphusrSIGNState!g
g/usrgroupIdusrLayout/s!usrgroupIdusrLayout!usrSIGNgroupIdusrSIGNLayout!g
g/createdusrbyusrcc/s!createdusrbyusrcc!cupcSIGNreatedusrSIGNbyusrSIGNcc!g
g/usrType/s!usrType!usrSIGNType!g
g/usrColor/s!usrColor!usrSIGNColor!g
g/usrAliases/s!usrAliases!usrSIGNAliases!g
g/usrConnections/s!usrConnections!usrSIGNConnections!g
g/usrConnectionDirection/s!usrConnectionDirection!usrSIGNConnectionDirection!g
g/iPusrAddress/s!iPusrAddress!iupcSIGNPusrSIGNAddress!g
g/sNMPusrRdCommunity/s!sNMPusrRdCommunity!supcSIGNNMPusrSIGNRdCommunity!g
g/sNMPusrWrCommunity/s!sNMPusrWrCommunity!supcSIGNNMPusrSIGNWrCommunity!g
g/sNMPusrVendorusrProxy/s!sNMPusrVendorusrProxy!supcSIGNNMPusrSIGNVendorusrSIGNProxy!g
g/sNMPusrTimeout/s!sNMPusrTimeout!supcSIGNNMPusrSIGNTimeout!g
g/sNMPusrSysObjectId/s!sNMPusrSysObjectId!supcSIGNNMPusrSIGNSysObjectId!g
g/physicalusrAddress/s!physicalusrAddress!pupcSIGNhysicalusrSIGNAddress!g
g/object1/s!object1!oupcSIGNbject1!g
g/object2/s!object2!oupcSIGNbject2!g
g/description/s!description!dupcSIGNescription!g
g/contact/s!contact!cupcSIGNontact!g
g/location/s!location!lupcSIGNocation!g
g/user/s!user!uupcSIGNser!g
g/ name "/s! name "! nupcSIGName "!g
g/dupcSIGNescription/.,+1s!netmask!nupcSIGNetmask!
g/hostData/.,+3s!dupcSIGNescription!description!
g/hostData/.,+4s!cupcSIGNontact!contact!
g/hostData/.,+5s!lupcSIGNocation!location!
g/defaultData/.,+3s!dupcSIGNescription!description!
w
q
IMPORTFILE7
echo "          Complete"
echo ""
echo "Conversion complete. Please use em_topoimex to import this file"
echo ""
